I am trying to use AWS Amplify's REST API with my android app. I did exactly as it was written in the docs, but I am still getting this error:
ApiException{message=AWSApiPlugin depends on AWSCognitoAuthPlugin but it is currently missing, cause=java.lang.IllegalStateException: Tried to get a plugin but that plugin was not present. Check if the plugin was added originally or perhaps was already removed., recoverySuggestion=Before configuring Amplify, be sure to add AWSCognitoAuthPlugin same as you added AWSApiPlugin.}
These are the AWS dependencies in my Gradle file:
dependencies {
// ...
implementation 'com.amplifyframework:aws-api:1.6.4'
implementation 'com.amplifyframework:core:1.6.4'
implementation 'com.amazonaws:aws-android-sdk-apigateway-core:2.3.2'
implementation 'com.amazonaws:aws-android-sdk-cognito:2.3.2'
// ...
}
This is my Application class:
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
try {
Amplify.addPlugin(AWSApiPlugin())
Amplify.configure(applicationContext)
Log.i("MyAmplifyApp", "Initialized Amplify.")
} catch (error: AmplifyException){
Log.e("MyAmplifyApp","Could not initialize Amplify.",error)
}
}
}