codelabやcodelabの解説サイトに沿ってコーディングをしていたところ、ビルドエラーとなり解決できなかったため質問しました。
https://codelabs.developers.google.com/codelabs/flutter-firebase/#0
terminalError
1$ flutter run 2 3Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, 4consider enabling software rendering with "--enable-software-rendering". 5Launching lib/main.dart on Android SDK built for x86 in debug mode... 6 7FAILURE: Build failed with an exception. 8 9* What went wrong: 10Execution failed for task ':cloud_firestore:parseDebugLibraryResources'. 11> Could not resolve all files for configuration ':cloud_firestore:androidApis'. 12 > Failed to transform file 'android.jar' to match attributes {artifactType=android-platform-attr, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime} 13 > Execution failed for PlatformAttrTransform: /Users/aaaaaaaaaaa/Library/Android/sdk/platforms/android-28/android.jar. 14 > /Users/aaaaaaaaa/Library/Android/sdk/platforms/android-28/android.jar (No such file or directory) 15 16* Try: 17Run 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. 18 19* Get more help at https://help.gradle.org 20 21BUILD FAILED in 4s 22Running Gradle task 'assembleDebug'... 23Running Gradle task 'assembleDebug'... Done 5.4s 24Gradle task assembleDebug failed with exit code 1
android/app/build.grableにてDartAnalysisのエラーがでていました。
def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } } def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") } def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' } def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' } apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { compileSdkVersion 29 sourceSets { main.java.srcDirs += 'src/main/kotlin' } lintOptions { disable 'InvalidPackage' } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" minSdkVersion 21 multiDexEnabled true // 追記 targetSdkVersion 29 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug } } } flutter { source '../..' } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' // add the Firebase SDK for Google Analytics implementation 'com.google.firebase:firebase-analytics:17.2.2' // add SDKs for any other desired Firebase products // https://firebase.google.com/docs/android/setup#available-libraries } apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin
android/build.grableも載せます。
buildscript { ext.kotlin_version = '1.3.50' repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.5.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.gms:google-services:4.3.3' // new } } allprojects { repositories { google() jcenter() } } rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(':app') } task clean(type: Delete) { delete rootProject.buildDir }
$ flutter doctor -v [✓] Flutter (Channel dev, v1.14.6, on Mac OS X 10.14.6 18G2022, locale ja-JP) • Flutter version 1.14.6 at /Users/aaaaaaaa/flutter • Framework revision fabeb2a16f (8 days ago), 2020-01-28 07:56:51 -0800 • Engine revision c4229bfbba • Dart version 2.8.0 (build 2.8.0-dev.5.0 fc3af737c7) [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3) • Android SDK at /Users/aaaaaaa/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 11.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.3.1, Build version 11C504 • CocoaPods version 1.8.4 [✓] Android Studio (version 3.5) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 43.0.1 • Dart plugin version 191.8593 • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) [✓] Connected device (1 available) • Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator) • No issues found!
$ ~/library/android/sdk/tools/bin/sdkmanager --list No Java runtime present, requesting install.
もし解決策がわかったらご教授お願いします!
その他試したこと
- $flutter channel devにてチャンネル変更(参考:https://www.isoroot.jp/blog/2079/)
- compileSdkVersion、targetSdkVersionを29にしたり、28にしたり
- iOSのエミュレータでは正常に動くことを確認しました。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/02/03 14:45 編集
2020/02/03 19:57 編集
2020/02/03 20:01
2020/02/05 12:44
2020/02/05 12:47 編集
2020/02/05 21:21 編集
2020/02/07 16:16
2020/02/07 20:49
2020/02/24 05:02