invertase / react-native-notifee

Moved to https://github.com/invertase/notifee
https://invertase.io/blog/open-sourcing-notifee
Other
465 stars 31 forks source link

[Android] Received crash: A migration from 2 to 1 was required but not found. #345

Closed MitinDmytro closed 3 years ago

MitinDmytro commented 3 years ago

Hi everyone! I received a crash when using my Android application.

Fatal Exception: java.lang.IllegalStateException: A migration from 2 to 1 was required but not found. Please provide the necessary Migration path via RoomDatabase.Builder.addMigration(Migration ...) or allow for destructive migrations via one of the RoomDatabase.Builder.fallbackToDestructiveMigration* methods.
       at androidx.room.RoomOpenHelper.onUpgrade(RoomOpenHelper.java:117)
       at androidx.room.RoomOpenHelper.onDowngrade(RoomOpenHelper.java:129)
       at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.onDowngrade(FrameworkSQLiteOpenHelper.java:188)
       at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:486)
       at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:387)
       at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getWritableSupportDatabase(FrameworkSQLiteOpenHelper.java:145)
       at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper.getWritableDatabase(FrameworkSQLiteOpenHelper.java:106)
       at androidx.room.RoomDatabase.inTransaction(RoomDatabase.java:476)
       at androidx.room.RoomDatabase.assertNotSuspendingTransaction(RoomDatabase.java:281)
       at n.o.t.i.f.e.e.nZ_ff.nz_t(SourceFile:2)
       at n.o.t.i.f.e.e.nZ_ff.lambda$ny-vs918yRdVebM4z1s0Re7pl2U()
       at n.o.t.i.f.e.e.-$$Lambda$nZ_ff$ny-vs918yRdVebM4z1s0Re7pl2U.run(:4)
       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)

Screenshot: crash

I used "@notifee/react-native": "^1.7.0" for display notification.

Steps to reproduce:

Code

Click To Expand

#### `package.json`: ```json { "name": "MyProject", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint .", "postinstall": "npx jetify", "build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/myproject/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'" }, "dependencies": { "@ingenuity-labs/react-native-api-client-wrapper": "^1.0.7", "@ingenuity-labs/react-native-async-storage-wrapper": "^1.0.3", "@notifee/react-native": "^1.7.0", "@react-native-community/checkbox": "^0.5.6", "@react-native-community/clipboard": "^1.5.1", "@react-native-community/geolocation": "^2.0.2", "@react-native-community/masked-view": "^0.1.10", "@react-native-community/netinfo": "^6.0.0", "@react-native-community/picker": "^1.8.1", "@react-native-community/progress-bar-android": "^1.0.4", "@react-native-community/progress-view": "^1.3.0", "@react-native-community/slider": "^3.0.3", "@react-native-community/toolbar-android": "0.1.0-rc.2", "@react-native-firebase/app": "^11.1.2", "@react-native-firebase/crashlytics": "^11.1.2", "@react-native-firebase/messaging": "^11.1.2", "@react-navigation/drawer": "^5.9.3", "@react-navigation/native": "^5.7.5", "@react-navigation/stack": "^5.9.2", "@types/jest": "^26.0.23", "buffer": "^6.0.3", "convert-string": "^0.1.0", "galio-framework": "^0.7.1", "lodash.debounce": "^4.0.8", "moment": "^2.29.1", "react": "^16.11.0", "react-chat-elements": "^10.12.0", "react-dom": "^17.0.1", "react-native": "^0.63.4", "react-native-android-immersive-mode": "^1.3.0", "react-native-animatable": "^1.3.3", "react-native-awesome-alerts": "^1.4.2", "react-native-background-fetch": "^4.0.2", "react-native-background-timer": "^2.4.1", "react-native-ble-manager": "^7.4.2", "react-native-ble-peripheral": "^2.0.1", "react-native-bluetooth-status": "^1.5.1", "react-native-collapsible": "^1.5.3", "react-native-date-picker": "^3.2.10", "react-native-default-preference": "^1.4.3", "react-native-device-info": "^8.1.2", "react-native-dropdown-picker": "^3.7.1", "react-native-elements": "^2.3.2", "react-native-exit-app": "^1.1.0", "react-native-fs": "^2.16.6", "react-native-gesture-handler": "^1.8.0", "react-native-i18n": "^2.0.15", "react-native-navigation-bar-color": "^2.0.1", "react-native-nfc-manager": "^3.3.0", "react-native-notification-sounds": "^0.5.3", "react-native-pdf": "^6.3.0", "react-native-raw-bottom-sheet": "^2.2.0", "react-native-really-awesome-button": "^1.6.0", "react-native-reanimated": "^1.13.1", "react-native-responsive-dimensions": "^3.1.1", "react-native-responsive-screen": "^1.4.2", "react-native-safe-area-context": "^3.1.8", "react-native-screens": "^2.11.0", "react-native-set-app-icon": "0.0.9", "react-native-side-menu-updated": "^1.2.1", "react-native-sound": "^0.11.0", "react-native-super-grid": "^4.0.3", "react-native-system-setting": "^1.7.5", "react-native-v8": "^0.63.4-patch.1", "react-native-vector-icons": "^6.7.0", "react-native-version-check": "^3.4.2", "react-native-volume-control": "^1.0.1", "react-navigation": "^4.4.3", "react-navigation-drawer": "^2.6.0", "react-navigation-stack": "^2.10.2", "react-onclickoutside": "^6.9.0", "react-redux": "^7.2.2", "redux": "^4.0.5", "rn-fetch-blob": "^0.12.0", "ts-jest": "^26.5.6", "typescript": "^4.2.4", "v8-android-jit": "^9.88.0" }, "devDependencies": { "@babel/core": "7.6.4", "@babel/runtime": "7.6.3", "@react-native-community/eslint-config": "0.0.5", "babel-jest": "24.9.0", "eslint": "6.6.0", "jest": "24.9.0", "jetifier": "^1.6.6", "metro-react-native-babel-preset": "0.57.0", "react-test-renderer": "16.9.0" }, "jest": { "preset": "react-native" } } ```

helenaford commented 3 years ago

Hey there what version of notifee are you using?

helenaford commented 3 years ago

I can see you have ^1.7.0 but there should be an exact version it's resolved to, either via package.lock or you can inspect the node module itself.

MitinDmytro commented 3 years ago

In my package-lock.json I see:


    "@notifee/react-native": {
      "version": "1.7.0",
      "resolved": "https://registry.npmjs.org/@notifee/react-native/-/react-native-1.7.0.tgz",
      "integrity": "sha512-oUuNXAkG9s42aVjMwzQxJfa6Qk1G1klFcHvTm76WiThwALlfIY7PVhgVlGHR7IPkl1aQVaitCIxO6cJT+SVEcw=="
    },
helenaford commented 3 years ago

Thanks. Were you using a different notifee version before this? 1.9.0+? I'm wondering if it's because you were using a newer version and then going back to an old one. I will mark this as a bug as we should take care of downgrades (a hunch this is what this could be)

Suraj3505 commented 3 years ago

Hi, I am facing the same issue. I have the 1.7.0 version. Any solutions?

mikehardy commented 3 years ago

Always start by making sure you are on the current stable version of everything, in general, if at all possible. This should resolve with current versions

helenaford commented 3 years ago

I'm closing this as there's no solution to fix this - any solution we push will require your users to update the app, which isn't going to stop the error.

If you are facing this issue, please update the library to the latest version.