Open6
Flutter * Firebaseのエラー
minSdkVersionがまずいと言っているが、根本原因はどこにあるのだろうか。
結局firebaseが一番の問題であることが判明した(サンプルプロジェクト単体の場合は動くため)
とすると、pubsupec yamlで持ち込んだfirebaseが間違っていた可能性が高い。
errorコードがこれのようなのだが……
uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [com.google.firebase:firebase-analytics:20.1.0] C:\Users\.gradle\caches\transforms-2\files-2.1\16f00cc28840d153ab6f9c1b8265da41\jetified-firebase-analytics-20.1.0\AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 19,
or use tools:overrideLibrary="com.google.firebase.firebase_analytics" to force usage (may lead to runtime failures)
FAILURE: Build failed with an exception.
flutter runをしたら kotlin gradle pluginのエラーで怒られた
Using hardware rendering with device Android SDK built for x86. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib\main.dart on Android SDK built for x86 in debug mode...
e: C:/Users/.gradle/caches/transforms-2/files-2.1/518a28e11257a17211a8fb8a5067b186/jetified-kotlinx-coroutines-core-jvm-1.5.2.jar!/META-INF/kotlinx-coroutines-core.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: C:/Users/.gradle/caches/transforms-2/files-2.1/6168eafaded8ddacbc73df91bd758ffe/jetified-window-1.0.0-beta04-api.jar!/META-INF/window_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: C:/Users/.gradle/caches/transforms-2/files-2.1/6c0671fbb7722afc42898b4178b11de7/jetified-kotlinx-coroutines-android-1.5.2.jar!/META-INF/kotlinx-coroutines-android.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: C:/Users/.gradle/caches/transforms-2/files-2.1/91667e970d35cee0f38e121291f325a1/jetified-kotlin-stdlib-common-1.5.31.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: C:/Users/.gradle/caches/transforms-2/files-2.1/af48bf569b5523ddd7a06285f676a1ca/jetified-kotlin-stdlib-jdk7-1.5.30.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module
was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: C:/Users/.gradle/caches/transforms-2/files-2.1/b560d76b568ab2e29107d94002f1a070/jetified-kotlin-stdlib-1.5.31.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: C:/Users/.gradle/caches/transforms-2/files-2.1/d0224631d7841d16cd3b5d2fab11c793/jetified-kotlin-stdlib-jdk8-1.5.30.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module
was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: C:/Users/.gradle/caches/transforms-2/files-2.1/e0583c70716c2ce3cdb07beee79fcae0/jetified-window-java-1.0.0-beta04-api.jar!/META-INF/window-java_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Compilation error. See log for more details
* 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 15s
Running Gradle task 'assembleDebug'... 16.7s
┌─ Flutter Fix ───────────────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project requires a newer version of the Kotlin Gradle plugin. │
│ Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then update │
│ F:\mineF\programing\wasedajin\wadvance\Wadvance\wadvance_app_front\android\build.gradle: │
│ ext.kotlin_version = '<latest-version>' │
└─────────────────────────────────────────────────────────────────────────────────────────────────────┘
Exception: Gradle task assembleDebug failed with exit code 1
kotlin gradleプラグインのバージョンエラーっぽいので、バージョンの記入を変えたらなおりました。
android/gradle
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}```
エラーの詳細を見るため、
optionを色々試すのが良い。
flutter runは全部まとめてやってしまうので、一つ一つ見るといいかも。
プロジェクトのディレクトリ直下で実行するとdevicesに見えているターゲット (Android/iOS優先) 向けにpub getやビルト、インストールまで一連の作業を実行してくれます。
とのことなので、これらを分解するのが吉と見る