My app started crashing after updating com.google.android:play-services-gcm from 11.8.0 to 12.0.0.
Crash appears in your library. Error is following:
java.lang.RuntimeException: Unable to create application: java.lang.IllegalArgumentException: The GcmTaskService class you provided com.evernote.android.job.gcm.PlatformGcmService does not seem to support receiving com.google.android.gms.gcm.ACTION_TASK_READY
Tested on 4.4.2.
Can you provide a sample to reproduce the issue?
Here is my sample code:
class CustomApplication : Application() {
override fun onCreate() {
super.onCreate()
JobManager.create(this).addJobCreator(CustomJobCreator())
CustomJob.schedule()
}
internal class CustomJobCreator : JobCreator {
override fun create(tag: String): Job? {
return when (tag) {
CustomJob.TAG -> CustomJob()
else -> null
}
}
}
internal class CustomJob : Job() {
override fun onRunJob(params: Params): Result {
return Result.SUCCESS
}
companion object {
const val TAG = "JOBTAG"
fun schedule() {
JobRequest.Builder(TAG)
.setExecutionWindow(1000, (60 * 5 * 1000).toLong())
.build()
.schedule()
}
}
}
}
It runs perfect on Android 8 in emulator, but crashes at startup on my test tablet with 4.4.2.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.anri.crashexample, PID: 18681
java.lang.RuntimeException: Unable to create application com.example.anri.crashexample.CustomApplication: java.lang.IllegalArgumentException: The GcmTaskService class you provided com.evernote.android.job.gcm.PlatformGcmService does not seem to support receiving com.google.android.gms.gcm.ACTION_TASK_READY
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4703)
at android.app.ActivityThread.access$1800(ActivityThread.java:143)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1346)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5398)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: The GcmTaskService class you provided com.evernote.android.job.gcm.PlatformGcmService does not seem to support receiving com.google.android.gms.gcm.ACTION_TASK_READY
at com.google.android.gms.gcm.GcmNetworkManager.zzc(Unknown Source)
at com.google.android.gms.gcm.GcmNetworkManager.schedule(Unknown Source)
at com.evernote.android.job.gcm.JobProxyGcm.plantOneOff(JobProxyGcm.java:73)
at com.evernote.android.job.JobManager.scheduleWithApi(JobManager.java:242)
at com.evernote.android.job.JobManager.schedule(JobManager.java:197)
at com.evernote.android.job.JobRequest.schedule(JobRequest.java:436)
at com.example.anri.crashexample.CustomApplication$CustomJob$Companion.schedule(CustomApplication.kt:38)
at com.example.anri.crashexample.CustomApplication.onCreate(CustomApplication.kt:14)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1009)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4700)
at android.app.ActivityThread.access$1800(ActivityThread.java:143)Â
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1346)Â
at android.os.Handler.dispatchMessage(Handler.java:102)Â
at android.os.Looper.loop(Looper.java:136)Â
at android.app.ActivityThread.main(ActivityThread.java:5398)Â
at java.lang.reflect.Method.invokeNative(Native Method)Â
at java.lang.reflect.Method.invoke(Method.java:515)Â
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)Â
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680)Â
at dalvik.system.NativeStart.main(Native Method)Â
I can reproduce the issue, but it's a bug on the GCM side. They must have changed something internally and now crash. You can forward them that information.
I'll try to find a workaround.
Same happening here, any news on this, i have a lot of crashes because of this
No new updates. You can revert the play services library if you want. It's an issue in their library.
I think it needs
<action android:name="com.google.android.gms.gcm.ACTION_TASK_READY" />
for that service in AndroidMainfest.xml
That's what's in there and it's working with older versions of the Play Services fine.
Have you tried to reproduce it on play-services 12.0.1? Was it fixed?
On 12.0.1 i tried. And i actually need to have the playservices at this version it is not an option for me to downgrade it.
On Friday, March 30, 2018, 3:28:00 PM GMT+3, Vladislav Nikolaev notifications@github.com wrote:
Have you tried to reproduce it on 12.0.1? If it was fixed
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
crashing in pre lollipop devices also with gcm:12.0.1. any updates ???
No, but you can turn off GCM in the meantime
Experiencing same issue, how should I turn off GCM?
Same issue over here any updates on this?
Always crashes on pre lollipop devices with gcm:12.0.1
I temporarily fixed it with by adding the service declaration in manifest:
<!-- Patch fixing issue of evernote SDK with new gcm 12.0.1 -->
<service
android:name="com.evernote.android.job.gcm.PlatformGcmService"
android:enabled="true"
android:exported="true"
android:permission="com.google.android.gms.permission.BIND_NETWORK_TASK_SERVICE"
tools:replace="android:enabled" >
<intent-filter>
<action android:name="com.google.android.gms.gcm.ACTION_TASK_READY" />
</intent-filter>
</service>
Has anyone tried reproducing this bug with Play Services 15.0.0? I've been trying myself, but I haven't been able to reproduce the bug on 12.0.0 either.
Just managed to reproduce this bug with 15.0.0 as well.
I can reproduce bug only on 4.4.2. I see lots of crashes in Crashlytics. Play services 12.0.1, Android-job 1.2.5.
Play Services 15.0.0 works at this moment without any workarounds.
@s-hocking how? It works for me atm
@tatocaster That's interesting - it doesn't work on my device. Samsung Galaxy Tab 3 8.0 with Android 4.4.2, Play Services 15.0.0, android-job 1.2.5. Using the sample code posted earlier in this thread.
Hmm, that's weird. Will try to investigate more about this bug but as a hotfix, I shipped a new version with 15.0.0 to avoid most crashes caused by 12.0.1. Google f@$%ed up seriously.
Looks like 15.0.0 is working fine and ticket could be closed (I think you should add information about buggy 12.0.X to readme). It's really interesting what kind of bug made them to bump up version from 12 to 15 in two weeks.
UPDATE: 15.0.0 is not fully working solution. It solves most of the crashes but I still got some crashes in Crashlytics from 15.0.0, which I could not reproduce on emulator anymore. The workaround above + v15.0.0 works right now. Let's see what will happen.
Have same. Only Samsung devices, only Android 4.
playServicesVersion = '15.0.0'
Galaxy S4 Mini 69%
Galaxy Tab E 9.6 20%
Galaxy S3 Neo 7%
Galaxy Grand Neo Plus 2%
Galaxy Tab3 Lite 7.0 2%
Caused by java.lang.IllegalArgumentException: The GcmTaskService class you provided com.evernote.android.job.gcm.PlatformGcmService does not seem to support receiving com.google.android.gms.gcm.ACTION_TASK_READY
at com.google.android.gms.gcm.GcmNetworkManager.zze(Unknown Source)
at com.google.android.gms.gcm.GcmNetworkManager.getInstance(Unknown Source)
at com.evernote.android.job.gcm.JobProxyGcm.cancel(JobProxyGcm.java:111)
at com.evernote.android.job.JobManager.cancelInner(JobManager.java:399)
at com.evernote.android.job.JobManager.cancelAllInner(JobManager.java:422)
at com.evernote.android.job.JobManager.cancelAllForTag(JobManager.java:1393)
at com.evernote.android.job.JobRequest.schedule(JobRequest.java:436)
at com.droid4you.application.wallet.jobs.internal.BaseJob.scheduleJob(BaseJob.java:66)
at com.droid4you.application.wallet.jobs.internal.BaseJob.schedule(BaseJob.java:27)
at com.droid4you.application.wallet.jobs.internal.JobsEnum$ScheduleAllAsyncTask.doInBackground(JobsEnum.java:104)
at com.droid4you.application.wallet.jobs.internal.JobsEnum$ScheduleAllAsyncTask.doInBackground(JobsEnum.java:95)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Maybe some bug in PlayServices?
Why don't we use 11.8.0 till google fixes all the bugs?
I spent a couple of hours debugging. This is what I found:
1) GcmNetworkManager behavior changed in Play services v 12.x and later. It calls PackageManager.queryIntentServices to find registered services which have com.google.android.gms.gcm.ACTION_TASK_READY. This is not new.
2) What's new is GcmNetworkManager now runs an additional check on the returned List<ResolveInfo>. It checks if resolveInfo.serviceInfo.enabled == true. Per official Android documentation the values in serviceInfo are from service declaration in app manifest.
3) android-job declares com.evernote.android.job.gcm.PlatformGcmService in the library manifest with android:enabled="false". The service is enabled programatically via code. The check in (2) only sees the static value in the manifest.
This is why the workaround posted by @maximrahlis (https://github.com/evernote/android-job/issues/415#issuecomment-380017997) works. It basically zeroes out android:enabled="false" in the library manifest
So why not to simply update this in library and set android:enabled="true"? Maybe it is simpler to disable service programmatically in code when it is not required, rather than enabling it when it needed, if new PlayServices require this and it does't look like a google bug? Or I'm wrong?
Edit: I may have spoken too soon about this one. Now I can't reproduce this crash any more. Can anyone else confirm whether the android:enabled="true" workaround works fine with no Play Services dependencies?
@anri-vin There's one downside to setting the PlatformGcmService to be always enabled - if the library is used in a project that does not have any Play Services libs linked, then the app will crash on launch with this exception:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.mavendeploytest, PID: 9807
java.lang.RuntimeException: Unable to instantiate service com.evernote.android.job.gcm.PlatformGcmService: java.lang.ClassNotFoundException: Didn't find class "com.evernote.android.job.gcm.PlatformGcmService" on path: DexPathList[[zip file "/data/app/com.example.mavendeploytest-MIrKK22dIN8B9y1rmchYSg==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.mavendeploytest-MIrKK22dIN8B9y1rmchYSg==/lib/arm64, /system/lib64, /vendor/lib64]]
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3324)
at android.app.ActivityThread.-wrap4(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1677)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.evernote.android.job.gcm.PlatformGcmService" on path: DexPathList[[zip file "/data/app/com.example.mavendeploytest-MIrKK22dIN8B9y1rmchYSg==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.mavendeploytest-MIrKK22dIN8B9y1rmchYSg==/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3321)
at android.app.ActivityThread.-wrap4(Unknown Source:0)Â
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1677)Â
at android.os.Handler.dispatchMessage(Handler.java:106)Â
at android.os.Looper.loop(Looper.java:164)Â
at android.app.ActivityThread.main(ActivityThread.java:6494)Â
at java.lang.reflect.Method.invoke(Native Method)Â
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)Â
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)Â
Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/gcm/GcmTaskService;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
... 10 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.gcm.GcmTaskService" on path: DexPathList[[zip file "/data/app/com.example.mavendeploytest-MIrKK22dIN8B9y1rmchYSg==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.mavendeploytest-MIrKK22dIN8B9y1rmchYSg==/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 13 more
I have this issue with a fleeting number of users that run Android 4.x. This isn't a huge issue for me and I don't expect a fix. Just providing this in-case it helps with debugging.
implementation "com.google.android.gms:play-services-gcm:15.0.1"
implementation 'com.evernote:android-job:1.2.1'

05-25 10:04:43.554 3177-3177/com.example.app E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.app, PID: 3177
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/com.example.app.LauncherActivity}: java.lang.IllegalArgumentException: The GcmTaskService class you provided com.evernote.android.job.gcm.PlatformGcmService does not seem to support receiving com.google.android.gms.gcm.ACTION_TASK_READY
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: The GcmTaskService class you provided com.evernote.android.job.gcm.PlatformGcmService does not seem to support receiving com.google.android.gms.gcm.ACTION_TASK_READY
at com.google.android.gms.gcm.GcmNetworkManager.zze(Unknown Source)
at com.google.android.gms.gcm.GcmNetworkManager.schedule(Unknown Source)
at com.evernote.android.job.gcm.JobProxyGcm.plantPeriodic(JobProxyGcm.java:86)
at com.evernote.android.job.JobManager.scheduleWithApi(JobManager.java:237)
at com.evernote.android.job.JobManager.schedule(JobManager.java:195)
at com.evernote.android.job.JobRequest.schedule(JobRequest.java:406)
at com.example.app.services.job.NewVersionJob.schedule(NewVersionJob.java:66)
at com.example.app.services.job.JobUtils.scheduleAllJobs(JobUtils.java:41)
at com.example.app.services.job.JobUtils.listJobs(JobUtils.java:36)
at com.example.app.LauncherActivity.continueCreating(LauncherActivity.java:63)
at com.example.app.LauncherActivity.onCreate(LauncherActivity.java:57)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)Â
at android.app.ActivityThread.access$800(ActivityThread.java:135)Â
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)Â
at android.os.Handler.dispatchMessage(Handler.java:102)Â
at android.os.Looper.loop(Looper.java:136)Â
at android.app.ActivityThread.main(ActivityThread.java:5017)Â
at java.lang.reflect.Method.invokeNative(Native Method)Â
at java.lang.reflect.Method.invoke(Method.java:515)Â
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)Â
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)Â
at dalvik.system.NativeStart.main(Native Method)Â
I tried to reproduce this issue again in an emulator with Android 4.4, but I can't. Can somebody help me? Is this still an issue or did Google fix the problem? I tried GCM version 12.0.0 and 15.0.1.
@vRallev I can still consistently reproduce this issue on an Android 4.4 emulator and a 4.4 Samsung device, with GCM 15.0.1. My test project is pretty simple:
build.gradle
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.evernotejobcrash"
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation "com.google.android.gms:play-services-gcm:15.0.1"
implementation 'com.evernote:android-job:1.2.5'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
MainApplication.java
public class MainApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
JobManager.create(this).addJobCreator(new CustomJobCreator());
new JobRequest.Builder(CustomJob.TAG)
.setExecutionWindow(1000, 10_000)
.build()
.schedule();
}
class CustomJobCreator implements JobCreator {
@Nullable
@Override
public Job create(@NonNull String tag) {
if (tag.equals(CustomJob.TAG)) {
return new CustomJob();
}
return null;
}
}
class CustomJob extends Job {
public final static String TAG = "JOBTAG";
@NonNull
@Override
protected Result onRunJob(@NonNull Params params) {
return Result.SUCCESS;
}
}
}
Uuh, I used an emulator without the Play Services. My bad, thanks for the snippet!
I released a new version https://github.com/evernote/android-job/releases/tag/v1.2.6. The library shouldn't crash anymore, but will fallback to the AlarmManager, if you don't manually enable the service like mentioned in the workaround. I've also updated the documentation: https://github.com/evernote/android-job#google-play-services
Please let me know if you're still having issues.
@vRallev I am still receiving this issue in Version: 4.4.2
Fatal Exception: java.lang.IllegalArgumentException
The GcmTaskService class you provided com.evernote.android.job.gcm.PlatformGcmService does not seem to support receiving com.google.android.gms.gcm.ACTION_TASK_READY
in:
com.evernote.android.job.gcm.JobProxyGcm.cancel (JobProxyGcm.java:102)
com.evernote.android.job.JobManager.cancelInner (JobManager.java:389)
com.evernote.android.job.JobManager.cancel (JobManager.java:362)
@isnyaga Do you have a sample project to reproduce the issue for me?
I am still getting this issue in Version 4.4, Nexus 7.
@vRallev have the same issue on samsung galaxy s4 mini (4.4.2)
new JobRequest.Builder(ReportJob.TAG)
.setRequiredNetworkType(JobRequest.NetworkType.CONNECTED)
.setExecutionWindow(1, EXECUTION_WINDOW)
.setUpdateCurrent(true)
.build()
.schedule();
Looks like this is still happening when calling JobManager.instance().cancelAllForTag(TAG);
Caused by java.lang.IllegalArgumentException: The GcmTaskService class you provided com.evernote.android.job.gcm.PlatformGcmService does not seem to support receiving com.google.android.gms.gcm.ACTION_TASK_READY
at com.google.android.gms.gcm.GcmNetworkManager.zze(Unknown Source:5000)
at com.evernote.android.job.gcm.JobProxyGcm.com.google.android.gms.gcm.GcmNetworkManager.cancelTask(SourceFile:7000)
at com.evernote.android.job.JobManager.cancelInner(SourceFile:389)
at com.evernote.android.job.JobManager.cancelAllInner(SourceFile:412)
at com.nomorobo.worker.CheckSubscriptionStatusWorker.com.evernote.android.job.JobManager.cancelAllForTag(SourceFile:8383)
at com.nomorobo.util.NomoroboBackgroundJobs.stop(SourceFile:95)
at com.nomorobo.receiver.UpdatedAppCompleted.onReceive(SourceFile:42)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2427)
at android.app.ActivityThread.access$1600(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1487)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:137)
We are currently stuck on this one w.r.t our release cycle. We don't see the fix in 1.2.6.. Can we get an ETA on this?
@mouli1382
The work-around/solution is to add GCM to your manifest:
<service
android:name="com.evernote.android.job.gcm.PlatformGcmService"
android:enabled="true"
tools:replace="android:enabled"/>
gradle:
dependencies {
compile "com.google.android.gms:play-services-gcm:latest_version"
}
Most helpful comment
I temporarily fixed it with by adding the service declaration in manifest: