🍶
Flutter3へアップグレードしたらapkをビルドできなくなった
自作のアプリをFlutter3へアップグレードしようとしたら、下記エラーでapkをビルドできなくなりました。
$ flutter build apk
(省略)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':image_picker_android:debugUnitTestRuntimeClasspath'.
> Failed to transform bcprov-jdk15on-1.68.jar (org.bouncycastle:bcprov-jdk15on:1.68) to match attributes {artifactType=processed-jar, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: /home/runner/.gradle/caches/modules-2/files-2.1/org.bouncycastle/bcprov-jdk15on/1.68/46a080368d38b428d237a59458f9bc915222894d/bcprov-jdk15on-1.68.jar.
> Failed to transform '/home/runner/.gradle/caches/modules-2/files-2.1/org.bouncycastle/bcprov-jdk15on/1.68/46a080368d38b428d237a59458f9bc915222894d/bcprov-jdk15on-1.68.jar' using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 59. (Run with --stacktrace for more details.)
Suggestions:
- Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there.
- If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).
* 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 2m 53s
Running Gradle task 'assembleRelease'... 174.4s
Gradle task assembleRelease failed with exit code 1
Error: Process completed with exit code 1.
Could not resolve all artifacts for configuration ':image_picker_android:debugUnitTestRuntimeClasspath'.
とあるので、image_picker_android
に問題があるようですが、自身のコードに由来したものではないようです。
Stack Overflowで同様の問題が挙がっており、そこの解決案通りに、lintオプションで一部無視するようにしたら、ビルドできるようになりました。
$ git diff
diff --git a/android/app/build.gradle b/android/app/build.gradle
index e5045a8..23ea52a 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -41,6 +41,13 @@ android {
main.java.srcDirs += 'src/main/kotlin'
}
+ lintOptions {
+ disable 'InvalidPackage'
+ disable "Instantiatable"
+ checkReleaseBuilds false
+ abortOnError false
+ }
+
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.uchi_sake"
参照
Discussion