JRockiller1
JRockiller1

Reputation: 11

AWS Amplify - No static method

I am trying to integrate amplify into my android application. i have followed the setup procedures beforehand:

try {
            Amplify.addPlugin(AWSCognitoAuthPlugin())
            Amplify.addPlugin(AWSPredictionsPlugin())
            Amplify.configure(applicationContext)

            Log.i("MyAmplifyApp", "Initialized Amplify")
        } catch (error: AmplifyException) {
            Log.e("MyAmplifyApp", "Could not initialize Amplify", error)
        }

I get this error:

java.lang.NoSuchMethodError: No static method AuthOption-Jh0Pmzk$default(Ljava/lang/String;Laws/smithy/kotlin/runtime/util/Attributes;ILjava/lang/Object;)Laws/smithy/kotlin/runtime/auth/AuthOption; in class Laws/smithy/kotlin/runtime/auth/AuthOptionKt; or its super classes (declaration of 'aws.smithy.kotlin.runtime.auth.AuthOptionKt' appears in /data/app/~~rDNGSxK_wBHLaFeI6UIjdw==/com.singhealth.enhance-_AVqqONMQSfk2M5hb3fAdQ==/base.apk!classes10.dex)

i have tried invalidating android studio cache, reimporting modules, use the lastest module version.

Upvotes: 0

Views: 74

Answers (1)

YassineKader
YassineKader

Reputation: 31

It might stem from problems within Android Studio's build cache or inconsistencies among dependency versions. Here are some troubleshooting steps to resolve it:

  1. Ensure you're using the latest versions of both Amplify and Amplify Cognito Auth. For example:
    implementation("com.amplifyframework:aws-auth-cognito:2.14.10")
    implementation("com.amplifyframework:aws-api:2.14.10")
    implementation("com.amplifyframework:aws-predictions:2.14.10")
  1. Rebuild the entire project Go to Build > Rebuild Project

Doing this resolved the issue for me.

Upvotes: 0

Related Questions