google play services extension, android 9, play crash errors

RizbIT

Member
Updated an app and then changed the target sdk version from 26 to 28 as that will soon be a requirement on Play (min target version).

Uploaded then from Android 9 user devices gets loads of crashes.

The crash info is as:
java.lang.RuntimeException:
at android.os.AsyncTask$3.done (AsyncTask.java:354)
at java.util.concurrent.FutureTask.finishCompletion (FutureTask.java:383)
at java.util.concurrent.FutureTask.setException (FutureTask.java:252)
at java.util.concurrent.FutureTask.run (FutureTask.java:271)
at android.os.AsyncTask$SerialExecutor$1.run (AsyncTask.java:245)
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:764)

Caused by: java.lang.NoClassDefFoundError:
at com.unity3d.ads.android.webapp.j.b (UnityAdsWebData.java:828)
at com.unity3d.ads.android.webapp.j.doInBackground (UnityAdsWebData.java:687)
at android.os.AsyncTask$2.call (AsyncTask.java:333)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)

Caused by: java.lang.ClassNotFoundException:
at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass (ClassLoader.java:379)
at java.lang.ClassLoader.loadClass (ClassLoader.java:312)
Now doing a bit of research found someone else who used Android Studio had the same issue and found it was something to do with this:
If you are using com.google.android.gms:play-services-maps:16.0.0 or below and your app is targeting API level 28 (Android 9.0) or above, you must include the following declaration within the element of AndroidManifest.xml.
See here for the thread:
https://stackoverflow.com/questions/53513210/java-lang-noclassdeffounderror-in-android-9-pie

Im using trhe most upto date v20.xx.xx build tools and i do use google play services extension, and in the 'inject to gradle dependencies' box we have:
compile 'com.google.android.gms:play-services-games:9.6.1'
compile 'com.google.android.gms:play-services-ads:9.6.1'
compile 'com.google.android.gms:play-services-plus:9.6.1'
compile 'com.google.android.gms:play-services-gcm:9.6.1'
so is this the issue and if so what is the solution? Is there a newer version (>16.0.0) of the Play Services extension we can use? At some point this wil have to be fixed if we want to upload a build that targets SDK 28
 
G

Guest

Guest
The thread you link, and the Android guidance document linked therein, concern the Google map SDK. It looks like your error is being caused by Unity Ads extension. Are you using a Unity Ads extension?
 

pipebkOT

Member
@RizbIT
Im using trhe most upto date v20.xx.xx build tools and i do use google play services extension, and in the 'inject to gradle dependencies' box we have:
compile 'com.google.android.gms:play-services-games:9.6.1'
compile 'com.google.android.gms:play-services-ads:9.6.1'
compile 'com.google.android.gms:play-services-plus:9.6.1'
compile 'com.google.android.gms:play-services-gcm:9.6.1'
that's a really old google play services extension, of course it will not work in android 28, google plus doesn't even exist anymore.

this is the actual gradle dependencies:

compile 'com.google.android.gms:play-services-games:16.0.0'
compile 'com.google.android.gms:play-services-ads:17.2.1'
compile 'com.google.android.gms:play-services-auth:16.0.1'
compile 'com.google.android.ads.consent:consent-library:1.0.3'
but as justice says, the main problem may be in the unity ads extension that you may be using, but you still really need to update that old google play services extension if you plan to use it:)
 
Last edited:

RizbIT

Member
do you mean i jus update the content in inject to gradle box, or i have to download new gps extension?
 

pipebkOT

Member
@RizbIT downloading the new extension of course, changing the inyections will do nothing, since they work with the java files inside the extension
 
Top