I'm making an Android app for college using AWS and Android Studio. I've been trying to figure out how it all works through https://docs.amplify.aws/start/q/integration/android but I can't seem to get it to work in the last part, which is connecting it to the cloud. When I run the app, I always get the following error:
AmplifyException {message=Failed to parse configuration JSON for AWS API Plugin, cause=AmplifyException {message=Failed to parse configuration, missing required key: endpoint, cause=null, recoverySuggestion=Sorry, we don't have a suggested fix for this error yet.}, recoverySuggestion=Check amplifyconfiguration.json to make sure the AWS API configuration section hasn't been wrongly modified.}
at com.amplifyframework.api.aws.AWSApiPluginConfigurationReader.parseConfigurationJson(AWSApiPluginConfigurationReader.java:97)
at com.amplifyframework.api.aws.AWSApiPluginConfigurationReader.readFrom(AWSApiPluginConfigurationReader.java:56)
at com.amplifyframework.api.aws.AWSApiPlugin.configure(AWSApiPlugin.java:127)
at com.amplifyframework.core.category.Category.configure(Category.java:86)
at com.amplifyframework.core.Amplify.configure(Amplify.java:153)
at com.amplifyframework.core.Amplify.configure(Amplify.java:120)
at com.example.todo.MyAmplifyApplication.onCreate(MyAmplifyApplication.java:18)
at android.app.Instrumentation.callApplicationOnCreate(Unknown Source:0)
at android.app.ActivityThread.handleBindApplication(Unknown Source:1209)
at android.app.ActivityThread.access$1400(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(Unknown Source:710)
at android.os.Handler.dispatchMessage(Unknown Source:19)
at android.os.Looper.loop(Unknown Source:242)
at android.app.ActivityThread.main(Unknown Source:98)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(Unknown Source:11)
at com.android.internal.os.ZygoteInit.main(Unknown Source:275)
Caused by: AmplifyException {message=Failed to parse configuration, missing required key: endpoint, cause=null, recoverySuggestion=Sorry, we don't have a suggested fix for this error yet.}
at com.amplifyframework.api.aws.AWSApiPluginConfigurationReader.parseConfigurationJson(AWSApiPluginConfigurationReader.java:72)
at com.amplifyframework.api.aws.AWSApiPluginConfigurationReader.readFrom(AWSApiPluginConfigurationReader.java:56)
at com.amplifyframework.api.aws.AWSApiPlugin.configure(AWSApiPlugin.java:127)
at com.amplifyframework.core.category.Category.configure(Category.java:86)
at com.amplifyframework.core.Amplify.configure(Amplify.java:153)
at com.amplifyframework.core.Amplify.configure(Amplify.java:120)
at com.example.todo.MyAmplifyApplication.onCreate(MyAmplifyApplication.java:18)
at android.app.Instrumentation.callApplicationOnCreate(Unknown Source:0)
at android.app.ActivityThread.handleBindApplication(Unknown Source:1209)
at android.app.ActivityThread.access$1400(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(Unknown Source:710)
at android.os.Handler.dispatchMessage(Unknown Source:19)
at android.os.Looper.loop(Unknown Source:242)
at android.app.ActivityThread.main(Unknown Source:98)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(Unknown Source:11)
at com.android.internal.os.ZygoteInit.main(Unknown Source:275)
I've followed the steps on the tutorial exactly but I'm always stuck here. Here's what I did:
- Run "amplify init" in the project's root directory
- Run "amplifyPush" (as shown in the tutorial)
Up to this point, the app is still working fine. It's in the next step that it always fails, which is to add:
Amplify.DataStore.observe(Todo.class,
started -> Log.i("Tutorial", "Observation began."),
change -> Log.i("Tutorial", change.item().toString()),
failure -> Log.e("Tutorial", "Observation failed.", failure),
() -> Log.i("Tutorial", "Observation complete.")
);
I've tried and made an entirely new project and made sure to follow the steps again but to no avail. I'm not sure if it's related or not, but I'm also using AWS through AWS Educate so there aren't as many resources showing how to use AWS' services using my limited account. Can anyone help? I'm completely stuck and I'm not even sure what's wrong. Any help is appreciated, thanks!