cybex-dev / twilio_voice

Flutter Twilio Voice Plugin
https://twilio-voice-web.web.app/
MIT License
39 stars 79 forks source link

[Android] Can't run project in flutter 3.19.0 #231

Open kkday-kevinhorasia opened 3 months ago

kkday-kevinhorasia commented 3 months ago

Issue Summary

Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Building with Flutter multidex support enabled.
ERROR:~/.gradle/caches/transforms-3/00d9d634312ff5516499237d011ad1ac/transformed/core-1.14.0-alpha01-runtime.jar: D8: java.lang.NullPointerException

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 core-1.14.0-alpha01.aar (androidx.core:core:1.14.0-alpha01) 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=26, 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: ~/.gradle/caches/transforms-3/00d9d634312ff5516499237d011ad1ac/transformed/core-1.14.0-alpha01-runtime.jar.
         > Error while dexing.
   > Failed to transform core-1.14.0-alpha01.aar (androidx.core:core:1.14.0-alpha01) 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=26, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: ~/.gradle/caches/transforms-3/00d9d634312ff5516499237d011ad1ac/transformed/core-1.14.0-alpha01-runtime.jar.
         > Error while dexing.
   > Failed to transform core-1.14.0-alpha01.aar (androidx.core:core:1.14.0-alpha01) 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=26, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: ~/.gradle/caches/transforms-3/00d9d634312ff5516499237d011ad1ac/transformed/core-1.14.0-alpha01-runtime.jar.
         > Error while dexing.
   > Failed to transform core-1.14.0-alpha01.aar (androidx.core:core:1.14.0-alpha01) 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=26, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: ~/.gradle/caches/transforms-3/00d9d634312ff5516499237d011ad1ac/transformed/core-1.14.0-alpha01-runtime.jar.
         > Error while dexing.
   > Failed to transform core-1.14.0-alpha01.aar (androidx.core:core:1.14.0-alpha01) 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=26, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: ~/.gradle/caches/transforms-3/00d9d634312ff5516499237d011ad1ac/transformed/core-1.14.0-alpha01-runtime.jar.
         > Error while dexing.
   > Failed to transform core-1.14.0-alpha01.aar (androidx.core:core:1.14.0-alpha01) 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=26, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: ~/.gradle/caches/transforms-3/00d9d634312ff5516499237d011ad1ac/transformed/core-1.14.0-alpha01-runtime.jar.
         > Error while dexing.
   > Failed to transform core-1.14.0-alpha01.aar (androidx.core:core:1.14.0-alpha01) 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=26, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: ~/.gradle/caches/transforms-3/00d9d634312ff5516499237d011ad1ac/transformed/core-1.14.0-alpha01-runtime.jar.
         > Error while dexing.
   > Failed to transform core-1.14.0-alpha01.aar (androidx.core:core:1.14.0-alpha01) 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=26, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: ~/.gradle/caches/transforms-3/00d9d634312ff5516499237d011ad1ac/transformed/core-1.14.0-alpha01-runtime.jar.
         > Error while dexing.
   > Failed to transform core-1.14.0-alpha01.aar (androidx.core:core:1.14.0-alpha01) 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=26, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: ~/.gradle/caches/transforms-3/00d9d634312ff5516499237d011ad1ac/transformed/core-1.14.0-alpha01-runtime.jar.
         > Error while dexing.
   > Failed to transform core-1.14.0-alpha01.aar (androidx.core:core:1.14.0-alpha01) 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=26, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: ~/.gradle/caches/transforms-3/00d9d634312ff5516499237d011ad1ac/transformed/core-1.14.0-alpha01-runtime.jar.
         > Error while dexing.
   > Failed to transform core-1.14.0-alpha01.aar (androidx.core:core:1.14.0-alpha01) 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=26, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: ~/.gradle/caches/transforms-3/00d9d634312ff5516499237d011ad1ac/transformed/core-1.14.0-alpha01-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

BUILD FAILED in 6s
Error: Gradle task assembleDebug failed with exit code 1

Exited (1).

Steps to Reproduce

  1. flutter pub add twilio_voice
  2. flutter run lib/main.dart

This error occur only after adding this twilio_voice package to my dependency, if I remove it then I can run the project normally. I think this happen because of this Breaking Changes.

Hopefully you can update this package and solve this problem. Thank you

kkday-kevinhorasia commented 3 months ago

I solve the problem by changing implementation 'androidx.core:core-ktx:+' in twilio_voice/android/build.gradle file as below:

dependencies {
    implementation(platform("org.jetbrains.kotlin:kotlin-bom:$kotlin_version"))
    implementation(platform("com.google.firebase:firebase-bom:32.2.2"))
    implementation("com.twilio:voice-android:6.3.2")
    implementation("com.google.firebase:firebase-messaging-ktx:23.2.1")
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'androidx.lifecycle:lifecycle-process:2.6.1'
    implementation 'androidx.core:core-ktx:1.13.1'
    runtimeOnly("androidx.lifecycle:lifecycle-extensions:2.2.0")
    runtimeOnly("androidx.constraintlayout:constraintlayout:2.1.4")
}

But, I am afraid this approach may affect some functionality in this package

Another solution is to add this in your flutter project android/app/build.gradle file:

configurations.all {
    resolutionStrategy { force 'androidx.core:core-ktx:1.13.1' }
}
yazanturk commented 3 months ago

@kkday-kevinhorasia project is running, but the first run crashed and happened exception when requesting permission from Twilio

kkday-kevinhorasia commented 3 months ago

Hi @yazanturk,

About requesting permission from Twilio, in my case it only work for the first time we installed and open the app. When we close app, clear app, open it again and request the same permission again it will not request it again.

I don't know why this happened, maybe you can open a new issue regarding this problem. And if you find the solution to the problem please let me know too :)

cybex-dev commented 3 months ago

Thank you for reporting the issue, I'll investigate this issue later the week.

yazanturk commented 3 months ago

@cybex-dev Thanks

yazanturk commented 3 months ago

Hi @yazanturk,

About requesting permission from Twilio, in my case it only work for the first time we installed and open the app. When we close app, clear app, open it again and request the same permission again it will not request it again.

I don't know why this happened, maybe you can open a new issue regarding this problem. And if you find the solution to the problem please let me know too :)

the problem is solved check the package please ?

kkday-kevinhorasia commented 3 months ago

Hi @yazanturk, About requesting permission from Twilio, in my case it only work for the first time we installed and open the app. When we close app, clear app, open it again and request the same permission again it will not request it again. I don't know why this happened, maybe you can open a new issue regarding this problem. And if you find the solution to the problem please let me know too :)

the problem is solved check the package please ?

I think it is not a problem according to this docs. It is actually android permissions default behavior (One-time permissions).