Android Question Failed resolution of Landroidx_work_impl_WorkDatabase

Luis Caballero

Member
Licensed User
I have this recurring error in my application that occurred in 50 users with 250 events from a universe of 5000 users.
I added the following library to Main: #AdditionalJar:androidx.work:work-runtime. and the error continues, it should be noted that I am using the latest version of B4A, admob2 works fine, I am using the AdsHelper code and the SDK Manager is intact.
How could I solve my problem? Thank you very much for your time

B4X:
Fatal Exception: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/work/impl/WorkDatabase;
at androidx.work.impl.WorkManagerImpl.<init>(WorkManagerImpl.java:242)
at androidx.work.impl.WorkManagerImpl.<init>(WorkManagerImpl.java:217)
at androidx.work.impl.WorkManagerImpl.initialize(WorkManagerImpl.java:196)
at androidx.work.WorkManager.initialize(WorkManager.java:210)
at com.google.android.gms.ads.internal.util.WorkManagerUtil.zzb(com.google.android.gms:play-services-ads-lite@@23.2.0:1)
at com.google.android.gms.ads.internal.util.WorkManagerUtil.zze(com.google.android.gms:play-services-ads-lite@@23.2.0:2)
at com.google.android.gms.ads.internal.util.zzbs.zzdF(com.google.android.gms:play-services-ads-lite@@23.2.0:9)
at com.google.android.gms.internal.ads.zzbae.onTransact(com.google.android.gms:play-services-ads-base@@23.2.0:3)
at android.os.Binder.transact(Binder.java:1406)
at m.ant.bh(:com.google.android.gms.policy_ads_fdr_dynamite@244410211@244410203017.691591528.691591528:8)
at com.google.android.gms.ads.nonagon.offline.buffering.c.a(:com.google.android.gms.policy_ads_fdr_dynamite@244410211@244410203017.691591528.691591528:82)
at com.google.android.gms.ads.nonagon.offline.buffering.h.b(:com.google.android.gms.policy_ads_fdr_dynamite@244410211@244410203017.691591528.691591528:5)
at m.cjm.run(:com.google.android.gms.policy_ads_fdr_dynamite@244410211@244410203017.691591528.691591528:30)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
 

asales

Expert
Licensed User
Longtime User
Does it happen on specific versions of Android?

Try to add:
B4X:
#AdditionalJar: androidx.lifecycle:lifecycle-service
I was going to start a post about this, but this thread came first.
I have the same error - showed in Crashlytics - in the several of my apps in the Play Store.

I tried to update the play-services and androix.work in the SDK without success.
I'll try this line in one of the apps and check if fixed the problem.

There is no specific version (Galaxy A25 - Android 14, Galaxy A02 - Android 11, Poco M6 Pro - Android 13, etc.).
 
Upvote 1

asales

Expert
Licensed User
Longtime User
Does it happen on specific versions of Android?

Try to add:
B4X:
#AdditionalJar: androidx.lifecycle:lifecycle-service
I update some apps (with the problem) in the Play Store and the error disappear.

But I found this link and it says that the LifecycleService is deprecated:
https://developer.android.com/reference/android/arch/lifecycle/LifecycleService

I think the problem is related with the Ads SDK.

This line can will be used even in the most recent Android versions?
 
Upvote 0

skaliwag

Member
Licensed User
Longtime User
My Apps are also now experiencing this problem.
It does not seem to be related to the Android version, or the App version.
The crashalytics would suggest the problem started at the beginning of February, so presumably this was an Android system update.
Will try the suggested fix.

EDIT : This does indeed seem to fix the problem. Thanks Erel
 
Last edited:
Upvote 0

asales

Expert
Licensed User
Longtime User
I started to receive this error again in Crashlytics.
Even using the code line above (that fixed the problem some months ago) the error restarted but only in Android 11+.
 
Upvote 0

asales

Expert
Licensed User
Longtime User
ChatGPT:
B4X:
This error indicates that the WorkDatabase component from the androidx.work (WorkManager) library is not being included in the final APK of your app — specifically on Android 11+, where WorkManager seems to be indirectly required by the Google Mobile Ads SDK (play-services-ads-lite).
The line you had already added:
#AdditionalJar: androidx.lifecycle:lifecycle-service
solves part of the issue, but does not include the full WorkManager, which is now being implicitly required by the Google Ads SDK.

Recommended Solution
Also add this #AdditionalJar line to your B4A code:
#AdditionalJar: androidx.work:work-runtime
This ensures that the WorkManager and its internal WorkDatabase are properly included in your APK.
I'll try this soluction.
 
Upvote 0
ChatGPT:
B4X:
This error indicates that the WorkDatabase component from the androidx.work (WorkManager) library is not being included in the final APK of your app — specifically on Android 11+, where WorkManager seems to be indirectly required by the Google Mobile Ads SDK (play-services-ads-lite).
The line you had already added:
#AdditionalJar: androidx.lifecycle:lifecycle-service
solves part of the issue, but does not include the full WorkManager, which is now being implicitly required by the Google Ads SDK.

Recommended Solution
Also add this #AdditionalJar line to your B4A code:
#AdditionalJar: androidx.work:work-runtime
This ensures that the WorkManager and its internal WorkDatabase are properly included in your APK.
I'll try this soluction.
I added this line but it still crashes and throws an error.
#AdditionalJar: androidx.work:work-runtime
 
Upvote 0
Can you post the latest crash report?
Exception java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/work/impl/WorkDatabase;
at androidx.work.impl.WorkManagerImpl.<init> (WorkManagerImpl.java:242)
at androidx.work.impl.WorkManagerImpl.<init> (WorkManagerImpl.java:217)
at androidx.work.impl.WorkManagerImpl.initialize (WorkManagerImpl.java:196)
at androidx.work.WorkManager.initialize (WorkManager.java:210)
at com.google.android.gms.ads.internal.util.WorkManagerUtil.zzb (com.google.android.gms:play-services-ads-lite@@23.2.0:1)
at com.google.android.gms.ads.internal.util.WorkManagerUtil.zze (com.google.android.gms:play-services-ads-lite@@23.2.0:2)
at com.google.android.gms.ads.internal.util.zzbs.zzdF (com.google.android.gms:play-services-ads-lite@@23.2.0:9)
at com.google.android.gms.internal.ads.zzbae.onTransact (com.google.android.gms:play-services-ads-base@@23.2.0:3)
at android.os.Binder.transact (Binder.java:1200)
at m.ana.bh :)com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:8)
at com.google.android.gms.ads.nonagon.offline.buffering.c.a :)com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:82)
at com.google.android.gms.ads.nonagon.offline.buffering.h.b :)com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:5)
at m.civ.run :)com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:30)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:644)
at java.lang.Thread.run (Thread.java:1012)
 
Upvote 0
Try it with:
B4X:
#AdditionalJar: androidx.work:work-runtime       
#AdditionalJar: androidx.room:room-runtime
Thank you.
We will try.
Another request I have is to test the Admob Firebase library with Gradle documentation that can be easily run in the studio so that we can update it ourselves.
 
Upvote 0

asales

Expert
Licensed User
Longtime User
Try it with:
B4X:
#AdditionalJar: androidx.work:work-runtime       
#AdditionalJar: androidx.room:room-runtime
I update an app in Play Store with the first line but still get an error.
I'll try with the 2 lines.
As I say before, it don't happens in all device, only in a few.
B4X:
Fatal Exception: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/work/impl/WorkDatabase;
       at androidx.work.impl.WorkManagerImplExtKt.createWorkManager$default(WorkManagerImplExt.kt:38)
       at androidx.work.impl.WorkManagerImplExtKt.createWorkManager(:20)
       at androidx.work.impl.WorkManagerImpl.initialize(WorkManagerImpl.java:214)
       at androidx.work.WorkManager$Companion.initialize(WorkManager.kt:201)
       at androidx.work.WorkManager.initialize(:2)
       at com.google.android.gms.ads.internal.util.WorkManagerUtil.zzb(com.google.android.gms:play-services-ads-api@@24.3.0:1)
       at com.google.android.gms.ads.internal.util.WorkManagerUtil.zze(com.google.android.gms:play-services-ads-api@@24.3.0:2)
       at com.google.android.gms.internal.ads.zzebt.zza(com.google.android.gms:play-services-ads@@24.3.0:8)
       at com.google.android.gms.internal.ads.zzebn.zza(:6)
       at com.google.android.gms.internal.ads.zzebs.zzb(com.google.android.gms:play-services-ads@@24.3.0:2)
       at com.google.android.gms.internal.ads.zzgcv.run(com.google.android.gms:play-services-ads@@24.3.0:6)
       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)
 
Upvote 0
Try it with:
B4X:
#AdditionalJar: androidx.work:work-runtime       
#AdditionalJar: androidx.room:room-runtime
By adding
#AdditionalJar: androidx.room:room-runtime
error

Dex merge error
Error in g:\sdk_b4a\tools\..\extras\b4a_remote\androidx\compose\animation\animation-lint\1.8.2\animation-lint-1.8.2.zip:classes.dex:
Type androidx.compose.lint.ComposableBodyVisitor$boundaryUElement$2 is defined multiple times: g:\sdk_b4a\tools\..\extras\b4a_remote\androidx\compose\animation\animation-lint\1.8.2\animation-lint-1.8.2.zip:classes.dex, g:\sdk_b4a\tools\..\extras\b4a_remote\androidx\compose\animation\animation-core-lint\1.8.2\animation-core-lint-1.8.2.zip:classes.dex
Compilation failed
Exception in thread "main" java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: g:\sdk_b4a\tools\..\extras\b4a_remote\androidx\compose\animation\animation-lint\1.8.2\animation-lint-1.8.2.zip:classes.dex
at com.android.tools.r8.internal.po.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:1269)
at com.android.tools.r8.D8.main(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:5)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: g:\sdk_b4a\tools\..\extras\b4a_remote\androidx\compose\animation\animation-lint\1.8.2\animation-lint-1.8.2.zip:classes.dex
at Version.fakeStackEntry(Version_8.3.37.java:0)
at com.android.tools.r8.Q.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:5)
at com.android.tools.r8.internal.po.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:244)
at com.android.tools.r8.internal.po.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:90)
at com.android.tools.r8.internal.po.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:909)
at com.android.tools.r8.internal.po.b(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:99)
at com.android.tools.r8.D8.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:1041)
at com.android.tools.r8.D8.b(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:514)
at com.android.tools.r8.D8.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:1076)
at com.android.tools.r8.internal.po.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:1256)
... 1 more
Caused by: com.android.tools.r8.internal.h: Type androidx.compose.lint.ComposableBodyVisitor$boundaryUElement$2 is defined multiple times: g:\sdk_b4a\tools\..\extras\b4a_remote\androidx\compose\animation\animation-lint\1.8.2\animation-lint-1.8.2.zip:classes.dex, g:\sdk_b4a\tools\..\extras\b4a_remote\androidx\compose\animation\animation-core-lint\1.8.2\animation-core-lint-1.8.2.zip:classes.dex
at com.android.tools.r8.internal.X30.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:346)
at com.android.tools.r8.internal.pX.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:232)
at com.android.tools.r8.internal.pX.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:91)
at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2056)
at com.android.tools.r8.internal.pX.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:32)
at com.android.tools.r8.graph.q4$a.d(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:6)
at com.android.tools.r8.dex.c.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:264)
at com.android.tools.r8.dex.c.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:222)
at com.android.tools.r8.dex.c.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:219)
at com.android.tools.r8.D8.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:809)
at com.android.tools.r8.D8.d(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:212)
at com.android.tools.r8.D8.c(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:163)
at com.android.tools.r8.internal.po.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:906)
... 6 more

And adding
#ExcludedLib:animation-core-lint-1.8.2
or
#ExcludedLib:animation-lint-1.8.2
does not solve the problem unfortunately
 
Upvote 0
Top