見出し画像

[Flutter] Android Stadio でデフォルトプロジェクトがエラーになる問題

どうしても解消できなかったけど、解決できたのでメモ。

プロジェクトを作ると、
デフォルトで右下の○ボタンを押すと真ん中のカウンターが加算される
アプリがテンプレートになりますが、Androidエミュレーター(ADV Manager)で出力しようと実行すると、下記のエラーになり実行できなかった。

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':app:processDebugManifest' (type 'ProcessMultiApkApplicationManifest').
> File 'x:\xxx\xxx\build\app\intermediates\merged_manifest\debug\out\AndroidManifest.xml' specified for property 'mainMergedManifest' does not exist.

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


散々調べて、2つのファイルを修正
これ、対応できるバージョンが決まってるのかなぁ。

\android\build.gradle

dependencies {
    classpath 'com.android.tools.build:gradle:4.1.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

↓ 4.0.2 に書き換える

dependencies {
    classpath 'com.android.tools.build:gradle:4.0.2'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}


\android\gradle\wrapper\gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

↓ 6.4.1 に書き換える

distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip

やっと起動した!




この記事が気に入ったらサポートをしてみませんか?