Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: build issue with 9.0.5 or later #436

Closed
kevin-do-zimplistic opened this issue May 31, 2024 · 23 comments
Closed

Android: build issue with 9.0.5 or later #436

kevin-do-zimplistic opened this issue May 31, 2024 · 23 comments
Assignees
Labels
crash Something is crashing platform-android Specific to Android platform support Asking for help writing an application

Comments

@kevin-do-zimplistic
Copy link

kevin-do-zimplistic commented May 31, 2024

Like title say, I couldn't run Android when upgrade to the latest version. The previous one (9.0.4) run fine so I think it's the problem with Intercom 15.9.0 Android sdk.

But the weird thing is: I created a new Android native project and used Intercom 15.9.0 sdk. It runs completely fine. Maybe it's a problem on your configuration or I have to change some setting in my build.gradle file?

Anyway, here's the error. Thanks in advance

* What went wrong:
Execution failed for task ':app:mergeExtDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform coil-base-2.6.0.aar (io.coil-kt:coil-base:2.6.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-is-debuggable=true, dexing-min-sdk=22, 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 DexingWithClasspathTransform: /Users/agile/.gradle/caches/transforms-3/cdea62b8822bb718721d819c249f708f/transformed/jetified-coil-base-2.6.0-runtime.jar.
         > Error while dexing.
   > Failed to transform appcompat-resources-1.6.1.aar (androidx.appcompat:appcompat-resources:1.6.1) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-is-debuggable=true, dexing-min-sdk=22, 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 DexingWithClasspathTransform: /Users/agile/.gradle/caches/transforms-3/f16c8b111a19dbacd248229b16f89bf3/transformed/jetified-appcompat-resources-1.6.1-runtime.jar.
         > Error while dexing.
   > Failed to transform material-1.9.0.aar (com.google.android.material:material:1.9.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-is-debuggable=true, dexing-min-sdk=22, 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 DexingWithClasspathTransform: /Users/agile/.gradle/caches/transforms-3/2e2e7004b9370e1a3a5bf4053440573a/transformed/material-1.9.0-runtime.jar.
         > Error while dexing.
   > Failed to transform vectordrawable-animated-1.2.0.aar (androidx.vectordrawable:vectordrawable-animated:1.2.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-is-debuggable=true, dexing-min-sdk=22, 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 DexingWithClasspathTransform: /Users/agile/.gradle/caches/transforms-3/2390bbc839b2d2897a3e78e6c033baf0/transformed/vectordrawable-animated-1.2.0-runtime.jar.
         > Error while dexing.
   > Failed to transform vectordrawable-1.2.0.aar (androidx.vectordrawable:vectordrawable:1.2.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-is-debuggable=true, dexing-min-sdk=22, 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 DexingWithClasspathTransform: /Users/agile/.gradle/caches/transforms-3/adb63201b440320f87e3c75755353450/transformed/vectordrawable-1.2.0-runtime.jar.
         > Error while dexing.
@nikorehnback
Copy link

I see errors only with these 2:

ERROR:/Users/xx/.gradle/caches/transforms-3/c9c4a6c8398129207db5dffbf5887ac1/transformed/vectordrawable-animated-1.2.0-runtime.jar: D8: java.lang.NullPointerException: Cannot invoke "String.length()" because "" is null
ERROR:/Users/xx/.gradle/caches/transforms-3/a474d1a68854176a87f44cbf4fccaf61/transformed/vectordrawable-1.2.0-runtime.jar: D8: java.lang.NullPointerException: Cannot invoke "String.length()" because "" is null

@kevin-do-zimplistic
Copy link
Author

I see errors only with these 2:

ERROR:/Users/xx/.gradle/caches/transforms-3/c9c4a6c8398129207db5dffbf5887ac1/transformed/vectordrawable-animated-1.2.0-runtime.jar: D8: java.lang.NullPointerException: Cannot invoke "String.length()" because "" is null
ERROR:/Users/xx/.gradle/caches/transforms-3/a474d1a68854176a87f44cbf4fccaf61/transformed/vectordrawable-1.2.0-runtime.jar: D8: java.lang.NullPointerException: Cannot invoke "String.length()" because "" is null

I have both.

@umar-hunch
Copy link

Getting the same error. Have locked the version as of now.

@gmcdowell
Copy link

I'm trying to support both platormrs and am stuck having to use 9.0.4 for Android and 9.0.6 for iOS.
Please fix ASAP as this is affecting our userss

@deepak786
Copy link
Collaborator

Could you please test the example app and see if it is running fine?

@deepak786 deepak786 added platform-android Specific to Android platform support Asking for help writing an application labels Jun 3, 2024
@kevin-do-zimplistic
Copy link
Author

kevin-do-zimplistic commented Jun 4, 2024

Could you please test the example app and see if it is running fine?

Tested the example app, it works.

I found the problem. We have to update the Gradle version to the same version in the example app. Closing the issue now

@Bojan227
Copy link

Bojan227 commented Jun 5, 2024

@kevin-do-zimplistic what file/files did you update?

@kevin-do-zimplistic
Copy link
Author

@kevin-do-zimplistic what file/files did you update?

The gradle-wrapper.properties file, 2 build.gradle files. And depend on your current packages, you have to upgrade the packages in pubspec.yaml to latest version as well.

@Bojan227
Copy link

Bojan227 commented Jun 5, 2024

@kevin-do-zimplistic Thank you.
I downgrade my gradle version from 8.7 to 8.5 and upgraded Android Gradle Plugin from 7.3 to 8.1.4

@benjamincombes
Copy link

Same here, we've been blocked with a major release for 4 days now, so it was at a very high business cost... Once the fix is out, it might be nice to add some tests to be sure such issues don't occur again? But glad a solution is on its way 🙏!

@greatschism
Copy link

Any luck with this situation?

@nikorehnback
Copy link

Is using gradle 8.5 safe solution since below Flutter doc states that supported gradle version goes up to 7.6.1 ?

https://docs.flutter.dev/release/breaking-changes/android-java-gradle-migration-guide

@kevin-do-zimplistic
Copy link
Author

Is using gradle 8.5 safe solution since below Flutter doc states that supported gradle version goes up to 7.6.1 ?

https://docs.flutter.dev/release/breaking-changes/android-java-gradle-migration-guide

Personally I run it fine.

I don't think that doc states that "supported gradle version goes up to 7.6.1". What it said is that if we use Gradle version > 7.6.1, we may have to change the Android file structure.

@kevin-do-zimplistic
Copy link
Author

Any luck with this situation?

I already posted my solution. Doesn't it work for you?

@benjamincombes
Copy link

Yes but actually, it means all builds will fail for most people using Intercom. No one knows the failing builds comes from Intercom. So if, by chance, people find this issue with a Google / Github search, and use the solution, that's nice. But a fix would really be needed for all other users, who'll have no more Android builds because they didn't get that link 😅

@Korpyc
Copy link

Korpyc commented Jul 26, 2024

Dear intercom_flutter dev team, wtf?!?
I spent a day of my work before I found reason of this issue, this tread not searchable via google!

Why such change not mentioned in changelog???
And why it was even done, rest of packages not do this breaking change with this major update of gradle

@eertmanhidde
Copy link

Hope this helps anyone:

Solution for me was disabling R8 full mode with android.enableR8.fullMode=false in gradle.properties

what is full mode?

In non-compat mode, also called “full mode”, R8 performs more aggressive optimizations, meaning additional ProGuard configuration rules may be required.

More here: https://r8.googlesource.com/r8/+/refs/heads/master/compatibility-faq.md#r8-full-mode

credits to this legend: https://stackoverflow.com/a/77494491/12190210 🎉

@deepak786
Copy link
Collaborator

You need to use AGP version 8. Please follow the below steps:

  • android/app/build.gradle
    Make sure to add the following under android section
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }
  • android/gradle/wrapper/gradle-wrapper.properties
    Update your distributionUrl
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
  • android/settings.gradle
id "com.android.application" version "8.1.4" apply false
id "org.jetbrains.kotlin.android" version "1.9.21" apply false

For ref see this commit: 6cd517b

@deepak786
Copy link
Collaborator

Repening as other users are facing the similar issues

@deepak786 deepak786 reopened this Aug 13, 2024
@deepak786
Copy link
Collaborator

deepak786 commented Aug 13, 2024

It seems that Intercom Android SDK v15.9.0 has some dependency updates. So it requires AGP 8. As it is the same issue with react native version also https://community.intercom.com/mobile-sdks-24/react-native-android-build-failed-rn-0-72-14-intercom-7-1-3-7398

  • If you want to use intercom_flutter: 9.0.5 or later, see this comment to update to AGP 8.

  • If you cannot update to AGP 8 at the moment, use intercom_flutter: 9.0.4.

@deepak786 deepak786 changed the title Can't run Android when upgrade to 9.0.5/9.0.6 Android: build issue with 9.0.5 or later Aug 13, 2024
@deepak786 deepak786 added the crash Something is crashing label Aug 13, 2024
@deepak786 deepak786 pinned this issue Aug 13, 2024
@olivierkastel
Copy link

olivierkastel commented Aug 22, 2024

I have the same issue and i'm unable to compile the app for Android.
And i also spent a lot of time finding this github issue... 😅

@gabulcw
Copy link

gabulcw commented Aug 29, 2024

I have the same issue here. I use Flutter 3.19.6

@deepak786
Copy link
Collaborator

Check this comment #436 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Something is crashing platform-android Specific to Android platform support Asking for help writing an application
Projects
None yet
Development

No branches or pull requests