google-gemini/generative-ai-android

Using the sdk on my flutter app through MethodChannel

bensonarafat opened this issue · 6 comments

Hi,
I am trying to use the SDK to communicate with my flutter app using methodchannel but i am getting this error

First this error

ERROR:C:\Users\xxxx\.gradle\caches\transforms-3\5d19816a0b04a46bdd05877142eefa50\transformed\jetified-generativeai-0.1.2-runtime.jar: D8: com.android.tools.r8.internal.Hc: Sealed classes are not supported as program classes

then this again

Execution failed for task ':app:mergeExtDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform generativeai-0.1.2.aar (com.google.ai.client.generativeai:generativeai:0.1.2) 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: C:\Users\Arafat Benson\.gradle\caches\transforms-3\5d19816a0b04a46bdd05877142eefa50\transformed\jetified-generativeai-0.1.2-runtime.jar.
         > Error while dexing.

could you help me with the cause of this? thanks

I'll will be happy, if i can get some help about this issue
Thanks

Hi @bensonarafat could you try adding

android.jetifier.ignorelist = generativeai:0.1.2.jar

to your gradle.properties file?

Okay, i'll try it

Thanks, I found a solution
I just added this to my settings.gradle

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

        }
    }
}

source -> https://issuetracker.google.com/issues/290412574?pli=1

That's great! And thanks for coming back and updating the issue with the workaround.

If i copy the same file
it was not giving me the solution
I am getting error If pasted the lines of code in the beginning or at the end.
How does it works for you Please Help me