Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not build the precompiled application for the device in IOS. #15

Open
oppq1234 opened this issue Aug 17, 2021 · 6 comments
Open

Comments

@oppq1234
Copy link

oppq1234 commented Aug 17, 2021

As title, when I tried to build my flutter project, it showed the message and error:

Xcode's output:
↳
    Command CompileSwift failed with a nonzero exit code
    .
    .
    .    
   Command CompileSwift failed with a nonzero exit code
    /usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_sequencer-0.3.2/ios/Clas
    ses/CocoaEngine.swift:52:95: error: cannot find type 'AKSampleDescriptor' in scope
        func addSampleToSampler(trackIndex: track_index_t, samplePath: String, isAsset:
        Bool, sd: AKSampleDescriptor, completion: @escaping (Bool) -> Void) {
                                                                                ^~~~~~~~~~
                                                                                ~~~~~~~~
    /usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_sequencer-0.3.2/ios/Clas
    ses/CocoaEngine.swift:21:9: error: cannot find 'AKSampler' in scope
            AKSampler.register()
            ^~~~~~~~~
    /usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_sequencer-0.3.2/ios/Clas
    ses/CocoaEngine.swift:22:9: error: cannot find 'AKSettings' in scope
            AKSettings.enableLogging = true
            ^~~~~~~~~~
    /usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_sequencer-0.3.2/ios/Clas
    ses/CocoaEngine.swift:40:39: error: cannot find 'AKSampler' in scope
            AVAudioUnit.instantiate(with: AKSampler.ComponentDescription, options: []) {
            avAudioUnit, err in
                                          ^~~~~~~~~
    /usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_sequencer-0.3.2/ios/Clas
    ses/CocoaEngine.swift:55:66: error: cannot find type 'AKSamplerAudioUnit' in scope
                    if let akSamplerAU = avAudioUnit.auAudioUnit as? AKSamplerAudioUnit {
                                                                     ^~~~~~~~~~~~~~~~~~
    /usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_sequencer-0.3.2/ios/Clas
    ses/CocoaEngine.swift:59:39: error: cannot find 'AKSampleFileDescriptor' in scope
                                    from: AKSampleFileDescriptor(sampleDescriptor: sd,
                                    path: buffer.baseAddress))
                                          ^~~~~~~~~~~~~~~~~~~~~~
    /usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_sequencer-0.3.2/ios/Clas
    ses/CocoaEngine.swift:64:44: error: cannot find 'AKAudioFile' in scope
                                let file = try AKAudioFile(forReading: url)
                                               ^~~~~~~~~~~
    /usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_sequencer-0.3.2/ios/Clas
    ses/CocoaEngine.swift:68:74: error: missing argument label 'arrayLiteral:' in call
                                var flattened = Array(file.floatChannelData!.joined())
                                                                             ^
                                                      arrayLiteral: 
    /usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_sequencer-0.3.2/ios/Clas
    ses/CocoaEngine.swift:70:66: error: cannot find 'AKSampleDataDescriptor' in scope
                                    akSamplerAU.loadSampleData(from:
                                    AKSampleDataDescriptor(sampleDescriptor: sd,
                                                                     ^~~~~~~~~~~~~~~~~~~~~
                                                                     ~
    /usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_sequencer-0.3.2/ios/Clas
    ses/CocoaEngine.swift:95:62: error: cannot find type 'AKSamplerAudioUnit' in scope
                if let akSamplerAU = avAudioUnit.auAudioUnit as? AKSamplerAudioUnit {
                                                                 ^~~~~~~~~~~~~~~~~~
    /usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_sequencer-0.3.2/ios/Clas
    ses/SwiftFlutterSequencerPlugin.swift:109:18: error: cannot find 'AKSampleDescriptor'
    in scope
            let sd = AKSampleDescriptor(
                     ^~~~~~~~~~~~~~~~~~
    /usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_sequencer-0.3.2/ios/Clas
    ses/CocoaEngine.swift:52:95: error: cannot find type 'AKSampleDescriptor' in scope
        func addSampleToSampler(trackIndex: track_index_t, samplePath: String, isAsset:
        Bool, sd: AKSampleDescriptor, completion: @escaping (Bool) -> Void) {
                                                                                ^~~~~~~~~~
                                                                                ~~~~~~~~
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete

Could not build the precompiled application for the device.

Error launching application on device. 

I have tried so many ways to solve the problem but had no idea.
Should I have to install some extensions or change some settings?

@mikeperri
Copy link
Owner

Looks like it can't find AudioKit for some reason. It should be installed by CocoaPods.

What command are you running to build? Also, are you on Apple Silicon?

I tried to reproduce this on my Intel Mac by cloning a fresh copy of the repo, like this, and everything looks fine:

git clone https://github.com/mikeperri/flutter_sequencer.git
Cloning into 'flutter_sequencer'...
remote: Enumerating objects: 475, done.
remote: Counting objects: 100% (475/475), done.
remote: Compressing objects: 100% (273/273), done.
remote: Total 475 (delta 195), reused 444 (delta 165), pack-reused 0
Receiving objects: 100% (475/475), 4.09 MiB | 13.03 MiB/s, done.
Resolving deltas: 100% (195/195), done.
cd flutter_sequencer/example 
flutter build ios
Running "flutter pub get" in example...                            704ms
Building com.example.flutterSequencerExample for device (ios-release)...
Warning: Missing build name (CFBundleShortVersionString).
Warning: Missing build number (CFBundleVersion).
Action Required: You must set a build name and number in the pubspec.yaml file version field before submitting to the App Store.
Automatically signing iOS for device deployment using specified development team in Xcode project: E92EJTVEYS
Running pod install...                                              6.1s
Running Xcode build...                                                  
 └─Compiling, linking and signing...                         9.1s
Xcode build done.                                           58.9s
Built /Users/mp/dev/temp/flutter_sequencer/example/build/ios/iphoneos.

@oppq1234
Copy link
Author

Looks like it can't find AudioKit for some reason. It should be installed by CocoaPods.

What command are you running to build? Also, are you on Apple Silicon?

I tried to reproduce this on my Intel Mac by cloning a fresh copy of the repo, like this, and everything looks fine:

git clone https://github.com/mikeperri/flutter_sequencer.git
Cloning into 'flutter_sequencer'...
remote: Enumerating objects: 475, done.
remote: Counting objects: 100% (475/475), done.
remote: Compressing objects: 100% (273/273), done.
remote: Total 475 (delta 195), reused 444 (delta 165), pack-reused 0
Receiving objects: 100% (475/475), 4.09 MiB | 13.03 MiB/s, done.
Resolving deltas: 100% (195/195), done.
cd flutter_sequencer/example 
flutter build ios
Running "flutter pub get" in example...                            704ms
Building com.example.flutterSequencerExample for device (ios-release)...
Warning: Missing build name (CFBundleShortVersionString).
Warning: Missing build number (CFBundleVersion).
Action Required: You must set a build name and number in the pubspec.yaml file version field before submitting to the App Store.
Automatically signing iOS for device deployment using specified development team in Xcode project: E92EJTVEYS
Running pod install...                                              6.1s
Running Xcode build...                                                  
 └─Compiling, linking and signing...                         9.1s
Xcode build done.                                           58.9s
Built /Users/mp/dev/temp/flutter_sequencer/example/build/ios/iphoneos.

I use Intel macOS to run and build with flutter command, and first, I install flutter_sequencer with pubspec.yaml but It can not work.
I have tried the example in your Github, it works, my project does, too.
I think that maybe the problem is in the CocoaPods.
It looks like it can't be found AudioKit, but strangely, I saw the error, It only showed type error, import AudioKit did not happen error(as the Xcode's output).

@mikeperri
Copy link
Owner

Hey, can you try again? I just published a new version of the library which uses a different SFZ player library instead of AudioKit.

@oppq1234
Copy link
Author

I try both Github example and Cocoapods download, neither of two ways can not use.
Here is the output:

Xcode's output:
↳
    /bin/sh: /Users/mp/dev/flutter/packages/flutter_tools/bin/xcode_backend.sh: No such
    file or directory
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete

Could not build the precompiled application for the device.

@mikeperri
Copy link
Owner

The last time I ran into that particular issue, I ended up just recreating the whole iOS project. Anyway, if the example project builds, I would make sure your project's Podfile is similar to the example project's Podfile. Can you post your project's Podfile? Also can you post the output from flutter doctor?

@oppq1234
Copy link
Author

oppq1234 commented Sep 2, 2021

This is my Podfile:

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

flutter doctor -v:

[✓] Flutter (Channel master, 2.5.0-2.0.pre.88, on macOS 11.4 20F71 darwin-x64, locale
    zh-Hant-TW)
    • Flutter version 2.5.0-2.0.pre.88 at /usr/local/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 9c32e5a1d2 (5 周前), 2021-07-30 00:20:45 -0700
    • Engine revision 884e9dacb9
    • Dart version 2.14.0 (build 2.14.0-363.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/ieddiei/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] VS Code (version 1.59.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.25.0

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.159

• No issues found!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants