-
Notifications
You must be signed in to change notification settings - Fork 548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pinpoint Analytics causes crash - SQLiteReadOnlyDatabaseException: attempt to write a readonly database #3565
Comments
Any kind help ? Thanks a lot~ |
Hi @frogoscar , thank you for your patience, our team will look into the issue |
Hi @frogoscar, thanks for your patient. I started to look at this and have a question about how you're calling SubmitEvents. From the snippits you provided it looks like you're submitting Pinpoint events immediately after you initialize the Pinpoint client. So how I read your flow is: App launch > Initialize Pinpoint > Submit local events > App has finished starting > Events are logged. I don't know the full workings of the Pinpoint client yet but I'm wondering if you're attempting to submit the events too early and running into a race condition where on certain user's devices, the database client isn't fully initialized and thus ready for writes. The issue that you linked was explicitly found during unit testing so the scenario for encountering that issue is pretty different than the real-life scenario you're encountering. Is there a reason you're trying to submit events so early/in the Application class? From documentation it looks like general best practice is to submit events at the end of the user's session. For cases of fatal recoveries, you can always try to submit events in some primary activity like your login, home, or similar activity. |
Hi, thank you very much for your kind reply. So maybe the reason is that I call So if I remove the code that calls Thanks a lot! |
That sounds more reasonable! If you take a look at the docs, there's an example that demonstrates that exact usecase (albeit written in Java): https://docs.amplify.aws/android/sdk/analytics/events/#reporting-session-events Basically, when the app enters foreground, you call Hopefully that fixes your problem but at a higher level suggestion, we do recommend you migrate over to use the Amplify SDK at your earliest convenience. |
@vincetran Thanks a lot. The calls of I would like to use the new Amplify SDK for Android, of course. But my Android app's minSdk is 21, while the latest Amplify SDK for Android (from version 2.0.0) requires Android minSdk >= 24). I have some customs whose Android devices still use Android 5 (Android SDK 21) ~ Android 6 (Android SDK 23). The latest version of Amplify SDK for Android that satisfies the condition of minSdk 21 is 1.38.8 (1.38.8 uses underlying version 2.73.0 of AWS SDK for Android ). Currently I use version 2.75.0 of AWS SDK for Android. In the future when I set my Android minSdk >= 24 , I will migrate to Amplify SDK for Android . |
@frogoscar Terribly sorry for the late reply I missed that you commented back. I suppose it's not mandatory to call Totally understand if you still need to support a lower minSDK version :) |
Thanks a lot. Now the usage of AWS Android SDK is OK. No crash detected. |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Describe the bug
After integrating AWS Pinpoint Analytics into my Android app, I notice many crashes reported on my Google Play Console, as below :
This crash is encountered mostly when opening the Android app.
The log of this crash is likely the same to #2520 .
From the log, I can say the crash occurs when AWS Pinpoint calls method
submitEvents()
. Please look at my usage as below.I firstly initialize AWS (in an Kotlin object class named
AnalyticsUtils
'sinit()
method) Pinpoint Analytics Client as belowRecord an event as below
Submit all events recorded in local SQLite database when app is launched (in the
onCreate()
method of the inherited Application class) as belowpinpointSubmitEvents()
method is defined in AnalyticsUtils.ktCould you tell me if I use the Pinpoint SDK incorrectly, how can I fix this crash ?
Or should I use the new Amplify SDK for Pinpoint Analytics instead ?
Thank you very much!
To Reproduce
The problem is that I can not reproduce this crash on my own physical Android device (which is OPPO K10x), it works fine. But when the Prod release is on Google Play, my users encounter crash, some users say that they encounter crash when opening my app.
Which AWS service(s) are affected?
AWS Pinpoint
Expected behavior
No crash.
Screenshots
Environment Information (please complete the following information):
com.amazonaws:aws-android-sdk-core:2.74.0
andcom.amazonaws:aws-android-sdk-pinpoint:2.74.0
. Not the new Amplify SDK )Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: