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

java.lang.NoClassDefFoundError In androidx.work.workmanager using Admob on some Android devices #276

Open
MyBuzzTechnologies opened this issue Jan 31, 2025 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@MyBuzzTechnologies
Copy link

We've been seeing an error in the Play console for a while but it's increased significantly since our last app update. Not sure why as it's still using Delphi 12.1 with the same components as the previous build. The only change was an update to the latest Kastri sources but I can't see anything new in the Firebase and Admob sources to cause this.
It looks like this is related to the Admob banner component we use in Kastri, or maybe the firebase libraries. We're still using Firebase 10.
We aren't using ads lite either (as far as I know) so no idea why this is even happening unless it's a red herring.

I wanted to seek help as it's now reporting over 1000 crashes in the past 7 days which is messing with our crash stats and likely losing user confidence.

The call stack is:

Exception java.lang.NoClassDefFoundError:
at androidx.work.impl.WorkManagerImpl. (WorkManagerImpl.java:222)
at androidx.work.impl.WorkManagerImpl.initialize (WorkManagerImpl.java:198)
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@@22.2.0:1)
at com.google.android.gms.ads.internal.util.WorkManagerUtil.zze (com.google.android.gms:play-services-ads-lite@@22.2.0:2)
at com.google.android.gms.ads.internal.util.zzbq.zzbE (com.google.android.gms:play-services-ads-lite@@22.2.0:3)
at com.google.android.gms.internal.ads.zzatp.onTransact (com.google.android.gms:play-services-ads-base@@22.2.0:3)
at android.os.Binder.transact (Binder.java:1054)
at m.ant.bh (:com.google.android.gms.policy_ads_fdr_dynamite@[email protected]:8)
at com.google.android.gms.ads.nonagon.offline.buffering.c.a (:com.google.android.gms.policy_ads_fdr_dynamite@[email protected]:82)
at com.google.android.gms.ads.nonagon.offline.buffering.h.b (:com.google.android.gms.policy_ads_fdr_dynamite@[email protected]:5)
at m.cjm.run (:com.google.android.gms.policy_ads_fdr_dynamite@[email protected]:30)
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)

Gemini is suggestion it's due to workmanager in the default Delphi 12.1 setup not including the R classes.
I can't reproduce this on any of my test devices. They all show ads without a problem and no logcat errors.
The crash is being reported on a range of device types and Android versions.

"The app is crashing because it cannot find a necessary resource from the AndroidX WorkManager library. Specifically, the androidx.work.R$bool class, which contains boolean resources used by the library, is not being found when the WorkManager is being initialized. This is happening during an operation related to Google Mobile Ads, as suggested by the presence of classes like com.google.android.gms.ads.internal.util.WorkManagerUtil in the stack trace. This indicates that the Google Mobile Ads SDK is attempting to utilize the WorkManager, but the WorkManager library, or a required part of it, seems to be missing or inaccessible at runtime."

This sounds like the R.jar for workmanager may need including but thought Delphi 12.1 did this automatically for the workmanager 2.7.0 library included by default.

Any help would be gratefully appreciated.

@DelphiWorlds DelphiWorlds self-assigned this Jan 31, 2025
@DelphiWorlds DelphiWorlds added the bug Something isn't working label Jan 31, 2025
@DelphiWorlds
Copy link
Owner

DelphiWorlds commented Jan 31, 2025

Does Play Console report the device model and Android version?

Gemini is suggestion it's due to workmanager in the default Delphi 12.1 setup not including the R classes.

I see no errors in the logs regarding R classes. This:

Exception java.lang.NoClassDefFoundError:
at androidx.work.impl.WorkManagerImpl. (WorkManagerImpl.java:222)
at androidx.work.impl.WorkManagerImpl.initialize (WorkManagerImpl.java:198)
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@@22.2.0:1)

Suggests that the package containing ads-lite is incompatible with the one containing WorkManager, which is work-runtime-2.7.0.jar (in Delphi 12.2), which is compatible according to this:

https://mvnrepository.com/artifact/com.google.android.gms/play-services-ads-lite/22.2.0

As far as I know, 12.2 has the same jars as 12.1, so presumably something else is at play here

@MyBuzzTechnologies
Copy link
Author

It's a range of devices, e.g. samsung e3q
samsung dm3q
samsung dm1q
google husky
Android 13, 14, 15 and 16.

Seems weird it's gotten worse recently.

The error doesn't mention R classes specifically but is java.lang.NoClassDefFoundError.

The title of the crash report is actually (if it helps):

com.google.android.gms.policy_ads_fdr_dynamite@[email protected] - m.ant.bh

Nothing has been changed with the default libraries for 12.1 in my app so whatever this is, not sure why something is missing.
I might try to use Codex to download the ad-lite framework again and see if anything is different.

@DelphiWorlds
Copy link
Owner

The error doesn't mention R classes specifically but is java.lang.NoClassDefFoundError.

Oops.. it seems it is an R class issue. This is the source at the time work-runtime 2.7.0 was released (Oct 13, 2021)

Line 222:

  context.getResources().getBoolean(R.bool.workmanager_test_configuration));

Though it's strange that the class is not specifically mentioned. I've downloaded the work-runtime 2.7.0 package:

work-runtime-2.7.0.zip

So hopefully, using the Add Android Package function of Codex (or whatever other process you use to generate R classes) to include this one may solve the issue. If I had one of those devices, I'd be able to test it :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants