I Upgraded the flutter to the lates version today at 24th of September 2024 and my project that i was working on is not compiling and building any more and give this error of android devices when i what to install the app for test:
*ERROR:/Users/UserName/.gradle/caches/transforms-3/525a3ec9924944fdf720d87028d1e961/transformed/appcompat-1.7.0-runtime.jar: D8: java.lang.NullPointerException: Cannot invoke “String.length()” because “” is null
ERROR:/Users/UserName/.gradle/caches/transforms-3/23f325e1b838060e9e8064e2aaad3f0e/transformed/jetified-appcompat-resources-1.7.0-runtime.jar: D8: java.lang.NullPointerException: Cannot invoke “String.length()” because “” is null
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ‘:app:mergeExtDexDebug’.
Could not resolve all files for configuration ‘:app:debugRuntimeClasspath’.
Failed to transform appcompat-resources-1.7.0.aar (androidx.appcompat:appcompat-resources:1.7.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for DexingNoClasspathTransform: /Users/harry/.gradle/caches/transforms-3/23f325e1b838060e9e8064e2aaad3f0e/transformed/jetified-appcompat-resources-1.7.0-runtime.jar.
> Error while dexing.
Failed to transform appcompat-1.7.0.aar (androidx.appcompat:appcompat:1.7.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for DexingNoClasspathTransform: /Users/harry/.gradle/caches/transforms-3/525a3ec9924944fdf720d87028d1e961/transformed/appcompat-1.7.0-runtime.jar.
> Error while dexing.
- 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*
Harry.R Jafari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I find the solution:
video solution: Youtube
- make sure you have the latest version of the flutter
flutter upgrade
- Run this
flutter pub upgrade --major-versions
-> this will get the most updated and compatibility versions of the packages in Android and IOS and flutter - then just run flutter clean && flutter pub get
Up to here this will solve the problem for the IOS
NOW FOR ANDROID:
-
get to
android/gradle/wrapper/gradle-wrapper.properties
and change the distributionUrl version to:distributionUrl=https://services.gradle.org/distributions/gradle-8.7-all.zip
-
then get to
android/settings.gradle
and update these 2 linesid "com.android.application" version "8.5.0" apply false
andid "org.jetbrains.kotlin.android" version "2.0.20" apply false
-
now get to
android/app/build.gradle
and update these 2 linescompileSdk = 34
andndkVersion = "26.1.10909125"
All DONE Hope this solution helped you
Harry.R Jafari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1