chyiiiiiiiiiiii / flutter_zendesk_messaging

Zendesk-Messaging for Flutter developer
Apache License 2.0
26 stars 40 forks source link

Error(Android) in zendesk_messaging Package After Upgrading Flutter to 3.22 #54

Open onurcevdetgungoren opened 1 month ago

onurcevdetgungoren commented 1 month ago

After upgrading Flutter to version 3.22, I encountered an error in the zendesk_messaging package that prevents the Android build from succeeding. When I remove the zendesk_messaging package, the app runs without issues. However, including the package results in the following error message:

ERROR:/Users/xyz/.gradle/caches/transforms-3/574dd8af09e1230485910d9bc3ac16d6/transformed/jetified-zendesk-android-1.16.0-runtime.jar: D8: com.android.tools.r8.internal.Hc: Sealed classes are not supported as program classes
Here is the full error log:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeExtDexDevelopmentDebug'.
> Could not resolve all files for configuration ':app:developmentDebugRuntimeClasspath'.
   > Failed to transform messaging-android-2.16.0.aar (zendesk.messaging:messaging-android:2.16.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-30, org.gradle.category=library, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=androidJvm}.
      > Execution failed for DexingNoClasspathTransform: /Users/xyz/.gradle/caches/transforms-3/3ec7cfa80830986072404a2b6b4361a/transformed/jetified-messaging-android-2.16.0-runtime.jar.
         > Error while dexing.

Actual Behavior: The build fails with a Sealed classes are not supported as program classes error when the zendesk_messaging package is included.

Flutter Version: Flutter 3.22

Gradle Version: 7.5

Additional Context: Removing the zendesk_messaging package resolves the issue, but the functionality provided by the package is needed. I suspect the issue might be related to compatibility between the zendesk_messaging package and the latest Flutter version. Request for Help: Could you provide guidance on resolving this issue? Is there a compatibility fix or workaround available for the zendesk_messaging package to work with Flutter 3.22? Any help would be greatly appreciated.

Thank you!

lanzhu1993 commented 1 month ago

After upgrading Flutter to version 3.22, I encountered an error in the zendesk_messaging package that prevents the Android build from succeeding. When I remove the zendesk_messaging package, the app runs without issues. However, including the package results in the following error message:

ERROR:/Users/xyz/.gradle/caches/transforms-3/574dd8af09e1230485910d9bc3ac16d6/transformed/jetified-zendesk-android-1.16.0-runtime.jar: D8: com.android.tools.r8.internal.Hc: Sealed classes are not supported as program classes
Here is the full error log:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeExtDexDevelopmentDebug'.
> Could not resolve all files for configuration ':app:developmentDebugRuntimeClasspath'.
   > Failed to transform messaging-android-2.16.0.aar (zendesk.messaging:messaging-android:2.16.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-30, org.gradle.category=library, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=androidJvm}.
      > Execution failed for DexingNoClasspathTransform: /Users/xyz/.gradle/caches/transforms-3/3ec7cfa80830986072404a2b6b4361a/transformed/jetified-messaging-android-2.16.0-runtime.jar.
         > Error while dexing.

Actual Behavior: The build fails with a Sealed classes are not supported as program classes error when the zendesk_messaging package is included.

Flutter Version: Flutter 3.22

Gradle Version: 7.5

Additional Context: Removing the zendesk_messaging package resolves the issue, but the functionality provided by the package is needed. I suspect the issue might be related to compatibility between the zendesk_messaging package and the latest Flutter version. Request for Help: Could you provide guidance on resolving this issue? Is there a compatibility fix or workaround available for the zendesk_messaging package to work with Flutter 3.22? Any help would be greatly appreciated.

Thank you!

I updated Flutter version to 3.22 today and encountered the same issue. The solution is as follows: add r8 support in Android settings. gradle

my flutter version info:

Flutter 3.22.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision a14f74ff3a (9 days ago) • 2024-05-22 11:08:21 -0500
Engine • revision 55eae6864b
Tools • Dart 3.4.1 • DevTools 2.34.3

settrings.gradle info:

image
pluginManagement {
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
    buildscript {
        repositories {
            mavenCentral()
            maven {
                url = uri("https://storage.googleapis.com/r8-releases/raw")
            }
        }
        dependencies {
            classpath("com.android.tools:r8:8.2.26")
        }
    }
}

this issue links: https://issuetracker.google.com/issues/227160052