1
1

FlutterでAndroidのビルドが失敗する

Posted at

少し手間取ったので忘備録として記載します。

現象

AndroidStdioをアップデート
いつものようにAndroidエミュレータを選択してビルドするとエラーが起きた

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> A problem occurred starting process 'command '/Users/{userName}/fvm/versions/3.16.0/bin/flutter''

* 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 2s
Exception: Gradle task assembleDebug failed with exit code 1

この後、--verboseで詳細のログを確認するとなんだかGradleが原因っぽい失敗の仕方をしていた。
そこを重点的に右往左往したが、
下記のstackOverFlowに辿り着いた。
https://stackoverflow.com/questions/60386994/gradle-build-failing-after-update/64054311#64054311

一見関係なさそうな感じではあるが、gradleデーモンを止めたところで再度、ビルドで立ち上がるので一度、止めてみた。

cd cd android

./gradlew --stop 
Stopping Daemon(s)
2 Daemons stopped

2つ消えた?
と思い再度、ビルドすると無事に通った

恐らく元々、動いていたデーモンが生きていてアップデートを行なってさらにデーモンが起動してしまったと推察している。
2つ起動しているため、キャッシュの整合性やリソース競合などが起こって正常にビルドができなかったのかも知れない。

ちなみにこの後、ビルドして再度デーモンを止めると今度は1つかないので、2つはやはり異常な状態であったと思う。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1