Skip to content
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

DataMigration NotImplementedError #146

Closed
brianwernick opened this issue Sep 5, 2023 · 2 comments · Fixed by #147
Closed

DataMigration NotImplementedError #146

brianwernick opened this issue Sep 5, 2023 · 2 comments · Fixed by #147
Assignees

Comments

@brianwernick
Copy link

Expected Behavior

When Amplitude is initialized the RemnantDataMigration is skipped when the DB doesn't exist (i.e. no error is thrown)

Current Behavior

When Amplitude is initialized the RemnantDataMigration throws the following exception

Fatal Exception: kotlin.NotImplementedError: An operation is not implemented.
       at kotlin.NotImplementedError.<init>(NotImplementedError.java:15)
       at com.amplitude.android.migration.DatabaseStorage.onCreate(DatabaseStorage.kt:53)
       at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:486)
       at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:415)
       at com.amplitude.android.migration.DatabaseStorage.getValueFromTable(DatabaseStorage.kt:222)
       at com.amplitude.android.migration.DatabaseStorage.getValue(DatabaseStorage.kt:206)
       at com.amplitude.android.migration.RemnantDataMigration.moveDeviceAndUserId(RemnantDataMigration.kt:48)
       at com.amplitude.android.migration.RemnantDataMigration.execute(RemnantDataMigration.kt:36)
       at com.amplitude.android.Amplitude.buildInternal$suspendImpl(Amplitude.kt:55)
       at com.amplitude.android.Amplitude.buildInternal(Amplitude.kt:1)
       at com.amplitude.core.Amplitude$build$built$1.invokeSuspend(Amplitude.kt:107)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
       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:919)

Possible Solution

Before attempting to migrate any data the RemnantDataMigration should first check if the Database exists and skip the migration if it doesn't (since the DatabaseStorage intentionally doesn't support creation).

Steps to Reproduce

Unfortunately this is being reported through Crashlytics on user devices so I don't have a set of reproduction steps, if you need more information please let me know and I'll try to provide it.

Environment

  • Library Version: analytics-android versions 1.10.2, 1.11.0
  • Device: Google Pixel 6a, Xiaomi Redmi Note 10T, Samsung (Galaxy S23 Ultra, J6, Tab A7)
  • Device OS and Version: Android 10 - 13
@justin-fiedler
Copy link
Contributor

Hi @brianwernick thanks for filing this issue. We will investigate and work on a fix.

@justin-fiedler
Copy link
Contributor

Fix released in 1.11.1. Thanks @brianwernick!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants