microg/GmsCore · error · IllegalArgumentException

No service found

Error message

No service found

What it means

GcmNetworkManager.validateService throws IllegalArgumentException when PackageManager.queryIntentServices finds no service in the app that handles the ACTION_TASK_READY intent. GCM requires at least one GcmTaskService declared in the manifest to receive scheduled work.

Source

Thrown at play-services-gcm/src/main/java/com/google/android/gms/gcm/GcmNetworkManager.java:238

    private boolean packageExists(String packageName) {
        try {
            PackageManager pm = context.getPackageManager();
            pm.getPackageInfo(packageName, 0);
            return true;
        } catch (PackageManager.NameNotFoundException e) {
            return false;
        }
    }

    private void validateService(String serviceName) {
        if (serviceName == null) throw new NullPointerException("No service provided");
        Intent taskIntent = new Intent(ACTION_TASK_READY);
        taskIntent.setPackage(context.getPackageName());
        PackageManager pm = context.getPackageManager();
        List<ResolveInfo> serviceResolves = pm.queryIntentServices(taskIntent, 0);
        if (serviceResolves == null || serviceResolves.isEmpty())
            throw new IllegalArgumentException("No service found");
        for (ResolveInfo info : serviceResolves) {
            if (serviceName.equals(info.serviceInfo.name)) return;
        }
        throw new IllegalArgumentException("Service not supported.");
    }
}

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Add the service to AndroidManifest.xml with <service android:name=".MyTaskService" android:exported="true" android:permission="com.google.android.gms.permission.BIND_NETWORK_TASK_SERVICE"><intent-filter><action android:name="com.google.android.gms.gcm.ACTION_TASK_READY"/></intent-filter></service>.
  2. Verify the manifest merge actually includes the service (check merged manifest in build output).
  3. Confirm the intent-filter action string is exactly com.google.android.gms.gcm.ACTION_TASK_READY.

Example fix

// before
// manifest missing the service -> "No service found"

// after
<service
    android:name="com.example.MyTaskService"
    android:exported="true"
    android:permission="com.google.android.gms.permission.BIND_NETWORK_TASK_SERVICE">
    <intent-filter>
        <action android:name="com.google.android.gms.gcm.ACTION_TASK_READY"/>
    </intent-filter>
</service>
Defensive patterns

Strategy: validation

Validate before calling

ResolveInfo info = getPackageManager().resolveService(
    new Intent("com.google.android.gms.gcm.ACTION_TASK_READY").setPackage(getPackageName()), 0);
if (info == null) {
    throw new IllegalStateException("GcmTaskService not declared in manifest");
}

Try / catch

try {
    manager.schedule(task);
} catch (IllegalArgumentException e) {
    Log.e(TAG, "No GcmTaskService registered: " + e.getMessage());
}

Prevention

When it happens

Trigger: Calling schedule/cancelTask/cancelAllTasks when no GcmTaskService is registered in AndroidManifest.xml with an intent filter for com.google.android.gms.gcm.ACTION_TASK_READY, or the query returns null/empty.

Common situations: Manifest service entry removed or never added; service declared only in a debug flavor's manifest; package rename that broke the manifest entry; missing intent-filter.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06). Data as JSON: /api/errors/36ef602833eaa677. Report an issue: GitHub.