Amplify getting started tutorial on Android crashes with SQLiteConstraintException
See original GitHub issueI am following the Ampligy getting started tutorial for Android https://docs.amplify.aws/start/getting-started/add-api/q/integration/android I am at the “Connect to the Cloud” step 5, and when I run the application, it crashes with:
E/Tutorial: Observation failed.
AmplifyException {message=Error in saving the model: ModelMetadata[id=318f28da-9d30-42b0-bc9e-505d41f9898f], cause=android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: ModelMetadata.id (code 1555 SQLITE_CONSTRAINT_PRIMARYKEY), recoverySuggestion=See attached exception for details.}
at com.amplifyframework.datastore.storage.sqlite.SQLiteStorageAdapter.lambda$save$3$SQLiteStorageAdapter(SQLiteStorageAdapter.java:333)
at com.amplifyframework.datastore.storage.sqlite.-$$Lambda$SQLiteStorageAdapter$lMf-ZzF10cDUtleQzXsLUxpfzAI.run(Unknown Source:12)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Caused by: android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: ModelMetadata.id (code 1555 SQLITE_CONSTRAINT_PRIMARYKEY)
at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:938)
at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:790)
at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:88)
at com.amplifyframework.datastore.storage.sqlite.SQLiteStorageAdapter.saveModel(SQLiteStorageAdapter.java:717)
at com.amplifyframework.datastore.storage.sqlite.SQLiteStorageAdapter.lambda$save$3$SQLiteStorageAdapter(SQLiteStorageAdapter.java:315)
at com.amplifyframework.datastore.storage.sqlite.-$$Lambda$SQLiteStorageAdapter$lMf-ZzF10cDUtleQzXsLUxpfzAI.run(Unknown Source:12)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Find here the project source: tutorial.zip
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Android Amplify Authentication with AWSMobileClient crashes ...
After entering my email and password and clicking "sign up", the new user gets created in my cognito user pool in my AWS...
Read more >Facing this crash on Nexus 5X on aws amplify - Stack Overflow
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List d.c.g.m.g()' on a null object reference at ...
Read more >[Solved]-React Native Web crashes with aws-amplify
I believe for your web app client you should be importing like this: import Amplify from 'aws-amplify';. jkeys 3600. Source: stackoverflow.com ...
Read more >Browse Android-textwatcher Answers - Code Matcher
App crashes on startup on android API 10 but not on API 16 because of Resources$ ... How to get Android resource ID...
Read more >Android - How can I make my custom view fill the whole screen? ( 10 ...
**So I have to make a random question for my logic quiz and I have a written code here. I do not know...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Well I was going through the tutorial and encountered this issue. https://docs.amplify.aws/start/getting-started/integrate/q/integration/android#create-a-todo Step 3 worked fine, made changes in step 4 and now it’s broken. Tried undo and rerun step 3 and it’s still failing. Not a good week to be trying to convince my team to use Amplify lol.
Same problem. Have gone through the complete tutorial three times now and it did work once.