'androidx.room.RoomOpenHelper.e (RoomOpenHelper.java:15)

I'm getting this error in Crashlytics (Firebase). The app is built in Flutter and I'm not sure about this error that I don't get locally:

Fatal Exception: java.lang.IllegalAccessError
Illegal class access: 'androidx.room.v' attempting to access 'androidx.work.impl.v' (declaration of 'androidx.room.v' appears in base.apk)
androidx.room.RoomOpenHelper.e (RoomOpenHelper.java:15)
androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.onUpgrade (FrameworkSQLiteOpenHelper.java:2)
android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked (SQLiteOpenHelper.java:489)
android.database.sqlite.SQLiteOpenHelper.getWritableDatabase (SQLiteOpenHelper.java:387)
androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getWritableSupportDatabase (FrameworkSQLiteOpenHelper.java:4)
androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper.getWritableDatabase (FrameworkSQLiteOpenHelper.java:4)
androidx.room.RoomDatabase.inTransaction (RoomDatabase.java:2)
androidx.room.RoomDatabase.assertNotSuspendingTransaction (RoomDatabase.java)
androidx.work.impl.model.SystemIdInfoDao_Impl.getWorkSpecIds (SystemIdInfoDao_Impl.java:9)
androidx.work.impl.background.systemjob.SystemJobScheduler.reconcileJobs (SystemJobScheduler.java:20)
androidx.work.impl.utils.ForceStopRunnable.cleanUp (ForceStopRunnable.java:1)
androidx.work.impl.utils.ForceStopRunnable.run (ForceStopRunnable.java:31)
androidx.work.impl.utils.SerialExecutor$Task.run (SerialExecutor.java:2)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
java.lang.Thread.run (Thread.java:923)

apparently, plenty of devices are getting this issue everyday in Android 11 and it happens when the user logs in (I know that because of Crashlytics)

My list of packages and their versions: l

ine_icons: ^2.0.1
  dapackages: ^1.6.0 # keeps packages updated: flutter pub pub run dapackages:dapackages.dart ./pubspec.yaml
  flutter_cupertino_localizations: ^1.0.1
  flutter_google_places: ^0.3.0
  maps_launcher: ^2.0.1 # REMOVED, USE OTHER INSTEAD
  uuid: ^3.0.5 # IDs for events
  cloudinary_public: ^0.11.0
  showcaseview: ^1.1.4 # help for new users
  provider: ^6.0.1
  cloud_firestore: ^3.1.5
  firebase_core: ^1.10.6 # needs Runner/GoogleService-Info.plist
  firebase_auth: ^3.3.4 # needs Runner/GoogleService-Info.plist
  firebase_analytics: ^9.0.4 # needs Runner/GoogleService-Info.plist
#  firebase_crashlytics: ^2.4.3 # needs Runner/GoogleService-Info.plist and NSAppTransportSecurity in Info.plist
  http: ^0.13.4
  badges: ^2.0.2
  flutter_translate: ^3.0.1
  flutter_facebook_auth: ^4.1.2
  google_sign_in: ^5.2.1 # needs Info.plist modification
  sign_in_with_apple: ^3.3.0  # needs Xcode modification https://pub.dev/packages/sign_in_with_apple
  shared_preferences: ^2.0.10
  share_plus: ^3.0.4
  intl: ^0.17.0 # locales for table_calendar and datetime manipulation
  jiffy: ^4.1.0 # date manipulation
  permission_handler: ^8.3.0 # needs Info.plist modification
  csv: ^5.0.1
  path_provider: ^2.0.8
  package_info_plus: ^1.3.0
  after_init: ^0.1.2 # NO NULL
  flutter_email_sender: ^5.0.2
  flutter_launcher_icons: ^0.9.2
  #  NEEDS TO BE UPDATED
  file_picker: ^4.2.7 # for multiple images selection
  image_picker: ^0.8.4+4 # for camera
  image: ^3.1.0
  url_launcher: ^6.0.17 # needs Info.plist modification
  transparent_image: ^2.0.0
  cached_network_image: ^3.2.0
  carousel_slider: ^4.0.0
  flutter_slidable: 1.0.0-dev.9
  flutter_svg: ^1.0.0
  table_calendar: ^3.0.3
  add_2_calendar: ^2.1.2 # Info.plist modification
  #  NEEDS TO BE UPDATED
  in_app_purchase: ^3.0.2 # official one.
  device_info_plus: ^3.1.1
  flutter_platform_widgets: ^1.12.0
  flutter_native_splash: ^1.3.2
  intl_phone_number_input: ^0.7.0+2  # NO NULL
  country_pickers: ^2.0.0
  currency_picker: ^2.0.7
  #  country_currency_pickers: ^1.0.1 # NO NULL
  reorderables: ^0.4.2 # NO NULL reorder rent fields
  drag_and_drop_gridview: ^1.0.8 # NO NULL
  pdf: ^3.6.5
  printing: ^5.6.6 # necessary for the above one
  open_file: ^3.2.1 # necessary for the above one
  #  flutter_statusbarcolor_ns: ^0.4.0 # DO NOT CHANGE
  fimber: ^0.6.4
  fluttercontactpicker: ^4.6.0
  contacts_service: ^0.6.3 # get contacts. Info.plist modification
  stack_appodeal_flutter: 1.1.0


Solution 1:[1]

For me, I'm suspected about one package that uses sqlite, cached_network_image-> flutter_cache_manager->sqflite, because I have this too. If I'm wrong, it must be android play store related problem because user catches this crash just after update, even before dart main function, in which I cleaned all app directories and cache data by code, and it wasn't usefull.

Yes most of users can use app after clean app data or reinstall app! But it's bad experience for user.

I have opened issue about it in github flutter repo: https://github.com/flutter/flutter/issues/100821

And found some interesting closed similar issue, in which author of issue answered has found problem, I have thought he can help us and asked for some help, right now no answer: https://github.com/adjust/flutter_sdk/issues/73

For caching image I think it's better to use some kind of nosql db but I have not found any package for image cache with nosql db yet. In the future it will be great to this kind of package.

Solution 2:[2]

I think I have found solution for this problem, I was getting same type crashes in plenty amount of devices everyday. For me it is about java version and gradle version. First I have tired to update gradle version to latest but java version was not enough to support latest version of gradle, and I was using default android studio java before, I think it was 1.8 version maybe and I installed latest version of java. And configured project to compile with new version of java. After that I rolled out several tests in play console. Till today app doesn't have mentioned crash.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MerdanDev
Solution 2 MerdanDev