Closed adnanali282 closed 6 years ago
I have the same issue. I am using Kotlin. After I add work manager dependencies (updated to this time current verisons) and rebuild add - I got same runtime exception.
Note that I use both versions of work manager: with -ktx and without.
Try updating Room to the newest version (currently: 1.1.1-rc1). This solved the issue for me.
Still got the exception even after change the Room version to latest version .. :(
Thanks for reporting this. I'm closing this issue because this forum is for issues with the codelab.
If you think that this is a problem of the WorkManager library, please open a bug on the WorkManager public issue tracker: https://issuetracker.google.com/issues/new?component=409906&template=1094197
Please reopen if you still think this is an issue with the codelab, however Stackoverflow might be a better forum for this kind of questions.
In this particular case you should be able to use jetifier
(in Android Studio).
Your dependencies on android.arch.*
get rewritten to to the appropriate androidx
packages.
You can find more information on this blog post.
Android Studio 3.2 helps you through this migration with a new refactoring action. To use the feature, navigate to: Refactor → Refactor to AndroidX. As an additional enhancement to the refactoring process, if you have any maven dependencies that have not migrated to the AndroidX namespace, the Android Studio build system will automatically convert those project dependencies as well. You can manually control the conversion process by toggling the
android.enableJetifier = true
flag in yourgradle.properties
file. While the refactoring action supports common project configurations, we recommend that you save a backup of your project before you refactor.
After adding workout manager dependencies already working module giving below error
java.lang.NoSuchMethodError: No direct method(Landroid/arch/persistence/room/DatabaseConfiguration;Landroid/arch/persistence/room/RoomOpenHelper$Delegate;Ljava/lang/String;)V in class Landroid/arch/persistence/room/RoomOpenHelper; or its super classes (declaration of 'android.arch.persistence.room.RoomOpenHelper' appears in /data/app/com.workoutapps.height.v2-FoiGsai4Uj3rgP8SvlPnOA==/split_lib_dependencies_apk.apk)
at androidx.work.impl.WorkDatabase_Impl.createOpenHelper(WorkDatabase_Impl.java:44)
at android.arch.persistence.room.RoomDatabase.init(RoomDatabase.java:110)
at android.arch.persistence.room.RoomDatabase$Builder.build(RoomDatabase.java:623)
at androidx.work.impl.WorkDatabase.create(WorkDatabase.java:100)
at androidx.work.impl.WorkManagerImpl.(WorkManagerImpl.java:159)
at androidx.work.impl.WorkManagerImpl.(WorkManagerImpl.java:138)
at androidx.work.impl.WorkManagerImpl.initialize(WorkManagerImpl.java:120)
at androidx.work.WorkManager.initialize(WorkManager.java:139)
at androidx.work.impl.WorkManagerInitializer.onCreate(WorkManagerInitializer.java:40)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1919)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1894)
at android.app.ActivityThread.installProvider(ActivityThread.java:6329)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5895)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5816)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1674)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6592)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:769)