{"record":{"id":"f6930e74ef24114d","repo":"microg/GmsCore","slug":"service-not-supported-f6930e","errorCode":null,"errorMessage":"Service not supported.","messagePattern":"Service not supported\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"play-services-gcm/src/main/java/com/google/android/gms/gcm/GcmNetworkManager.java","lineNumber":242,"sourceCode":"            pm.getPackageInfo(packageName, 0);\n            return true;\n        } catch (PackageManager.NameNotFoundException e) {\n            return false;\n        }\n    }\n\n    private void validateService(String serviceName) {\n        if (serviceName == null) throw new NullPointerException(\"No service provided\");\n        Intent taskIntent = new Intent(ACTION_TASK_READY);\n        taskIntent.setPackage(context.getPackageName());\n        PackageManager pm = context.getPackageManager();\n        List<ResolveInfo> serviceResolves = pm.queryIntentServices(taskIntent, 0);\n        if (serviceResolves == null || serviceResolves.isEmpty())\n            throw new IllegalArgumentException(\"No service found\");\n        for (ResolveInfo info : serviceResolves) {\n            if (serviceName.equals(info.serviceInfo.name)) return;\n        }\n        throw new IllegalArgumentException(\"Service not supported.\");\n    }\n}\n","sourceCodeStart":224,"sourceCodeEnd":245,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-gcm/src/main/java/com/google/android/gms/gcm/GcmNetworkManager.java#L224-L245","documentation":"GcmNetworkManager.validateService throws IllegalArgumentException when the provided service name is not among the services resolved for ACTION_TASK_READY. I.e. some GcmTaskService exists in the app, but not the specific one named.","triggerScenarios":"Calling cancelTask(tag, WrongService.class) or scheduling with a class whose name doesn't match any manifest service with the ACTION_TASK_READY intent filter.","commonSituations":"Passing the Application class or an unrelated Service class; typo in the class reference; a service declared in the manifest without the correct intent filter so it isn't in the resolved list; refactoring that renamed the service class but not all call sites.","solutions":["Pass exactly the GcmTaskService subclass declared in your manifest with the ACTION_TASK_READY intent filter.","Compare the class name against the list of services in the merged manifest.","Fix the service's intent-filter so the intended class is resolvable for ACTION_TASK_READY."],"exampleFix":"// before\ngcmNetworkManager.cancelTask(tag, SomeOtherService.class); // \"Service not supported.\"\n\n// after\ngcmNetworkManager.cancelTask(tag, MyTaskService.class); // the manifest-registered GcmTaskService","handlingStrategy":"validation","validationCode":"// Ensure the class passed is the manifest-declared GcmTaskService\nPackageManager pm = getPackageManager();\nList<ResolveInfo> list = pm.queryIntentServices(\n    new Intent(\"com.google.android.gms.gcm.ACTION_TASK_READY\").setPackage(getPackageName()), 0);\nboolean supported = false;\nfor (ResolveInfo ri : list) {\n    if (MyTaskService.class.getName().equals(ri.serviceInfo.name)) { supported = true; break; }\n}","typeGuard":"boolean isRegisteredTaskService(Class<?> c) { return GcmTaskService.class.isAssignableFrom(c); }","tryCatchPattern":"try {\n    manager.cancelTask(tag, MyTaskService.class);\n} catch (IllegalArgumentException e) {\n    Log.e(TAG, \"Service not registered for GCM tasks\");\n}","preventionTips":["Always pass the concrete GcmTaskService subclass, never an unrelated Service class","Keep class names in sync after refactors","Verify the intent-filter points at the intended class"],"tags":["gcm","android","manifest","wrong-service"],"backgroundTag":"invalid-argument-value","analyzedSha":"157c9d86ac46c195a86c2f15ab55c84036223f95","analyzedAt":"2026-09-06T17:27:33.892Z","contentChangedAt":"2026-09-06T17:27:33.892Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}