Open5

【Flutter】エラーとの闘い

sho5sho5

【Flutter】error: could not find included file 'Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig' in search paths

$ flutter build ios

// 以下のエラーが発生
Error (Xcode): could not find included file 'Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig' in search paths
// 全てダメ
$ pod install
$ flutter clean
$ flutter pub get
// これもダメ
$rm podfile
$pod init
$pod install

これで解決

ios/Flutter/Debug.xcconfig

- #include "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"
+ #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"

自分の場合は先頭の「Pods/」がなくて、追記すると解決

https://stackoverflow.com/questions/53630136/using-cocoapods-libraries-in-flutter-ios-platform-specific-code

sho5sho5

【未解決】【Flutter】Dart-defineを実行すると「File name too long」が表示されてビルドが出来なくなる

// これを実行してから...
$ flutter run --debug --dart-define=FLAVOR=dev  
// failed: File name too long というエラー発生
Launching lib/main.dart on iPhone 12 in debug mode...
Xcode build done.                                           282.7s
Unable to install /Users/{名前}/Developer/{プロジェクト名}/build/ios/iphonesimulator/Runner.app on XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX. This is sometimes caused by a malformed plist file:
ProcessException: Process exited abnormally:
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=63):
copyfile of file:///Users/{名前}/Developer/{プロジェクト名}/build/ios/iphonesimulator/Runner.app/ to file:///Users/{名前}/Library/Developer/CoreSimulator/Devices/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/data/Containers/Shared/SystemGroup/systemgroup.com.apple.installcoordinationd/Library/InstallCoordination/PromiseStaging/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/Runner.app failed: File name too long
Unhandled error domain NSPOSIXErrorDomain, code 63
  Command: xcrun simctl install XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX /Users/{名前}/Developer/{プロジェクト名}/build/ios/iphonesimulator/Runner.app
Error launching application on iPhone 12.
Exited (sigterm)

最初はiOSのシミュレーターがビルド出来なくなり、AndroidのEmulatorに切り替えてビルドするも、次第にEmulatorもビルド出来なくなる(同じく too long〜 が表示される)

問題解決のため、CocoaPods関連の修正処理を実行すると、別のバグが出始めて、全くビルドが出来ない状態

// 該当エラー
The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.4.99
Podfile
// 解決のために以下を実行すると別のエラー
// この書き方は次のエラーを生むため良くないらしい
post_install do |installer|
  installer.pods_project.targets.each do |target|
+   target.build_configurations.each do |config|
+      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
+   end
  end
end
// 該当エラー
Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found

未解決

sho5sho5

【Flutter】1つのシミュレーターでビルドしているのに、何故か2つのシミュレーターを使っている事になっている

▼該当エラー

database is locked Possibly there are two concurrent builds running in the same filesystem location.

// エラー全文
Launching lib/main.dart on iPhone 12 Pro in debug mode...
Xcode build failed due to concurrent builds, will retry in 2 seconds.
Xcode build done.                                           30.9s
Failed to build iOS app
Error output from Xcode build:
↳
    xcodebuild: error: Existing file at -resultBundlePath "/var/folders/y6/0x_zgh5x7xg5d_pjtgj_ym3c0000gn/T/flutter_tools.DOzHGC/flutter_ios_build_temp_dir3ppSNS/temporary_xcresult_bundle.xcresult"
Error (Xcode): unable to attach DB: error: accessing build database "/Users/{名前}/Library/Developer/Xcode/DerivedData/Runner-euennogxldigrqexdkjdbolrufkb/Build/Intermediates.noindex/XCBuildData/build.db": database is locked Possibly there are two concurrent builds running in the same filesystem location.

Could not build the application for the simulator.
Error launching application on iPhone 12 Pro.
Exited (sigterm)
sho5sho5

【Flutter】Androidでビルドが通らない(Execution failed for task ':app:compileFlutterBuildDebug'.)

FAILURE: Build failed with an exception.

* Where:
Script '/Users/{名前}/Developer/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1102

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/shogo.y/Developer/flutter/bin/flutter'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 52s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
過程

これを試したいけど、アップグレードできなくて
https://stackoverflow.com/questions/69314404/how-to-solve-the-error-failure-build-failed-with-an-exception-where-script


以下の方法でエラーが判明??

$ cd android
$ ./gradlew assembleDebug --stacktrace
> Configure project :amplify_api
WARNING: The option setting 'android.enableR8=true' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8

> Task :amplify_core:compileDebugKotlin FAILED
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':amplify_core:compileDebugKotlin'.
> Failed to query the value of task ':amplify_core:compileDebugKotlin' property 'compilerRunner$kotlin_gradle_plugin'.
   > Kotlin could not find the required JDK tools in the Java installation. Make sure Kotlin compilation is running on a JDK, not JRE.

https://stackoverflow.com/questions/60186072/how-to-run-with-stacktrace-option-to-get-the-stack-trace


施策1(解決せず)

Go to your build.gradle file in the root of your Android directory and upgrade your Kotlin_version to the latest. As of the time of typing this, the latest is 1.5.10, so it should look like this:
ext.kotlin_version = '1.5.10'

(訳) Androidディレクトリのルートにあるbuild.gradleファイルを開き、Kotlin_versionを最新のものにアップグレードしてください。これを入力している時点では、最新は1.5.10なので、以下のようになっているはずです。
ext.kotlin_version = '1.5.10' とします。

https://stackoverflow.com/questions/59893018/flutter-execution-failed-for-task-appcompiledebugkotlin
▼kotlin最新バージョン
https://kotlinlang.org/docs/gradle.html

施策2

記事を元に以下を実行するとビルドに成功

https://stackoverflow.com/questions/69314404/how-to-solve-the-error-failure-build-failed-with-an-exception-where-script

sho5sho5

【Flutter】iOSのSimulatorでビルドが通らずお手上げ状態の時に確認する事

  1. AndroidのEmulatorではビルドが通るか?
  2. 上記でもビルドが通らない場合、そちらから何か影響を受けている可能性がある
  3. 上記のビルドエラーを解消する事で、なぜかSimulatorもビルドできるようになった、という事例発生