microg/GmsCore · error · IllegalArgumentException

Missing package name

Error message

Missing package name

What it means

ReportingAndroidService.handleServiceRequest binds incoming GMS service connection requests for location reporting. It validates the claimed package name with PackageUtils.getAndCheckCallingPackage(this, request.packageName); if that returns null (either no package name supplied in the GetServiceRequest or the caller's actual package does not match), an IllegalArgumentException 'Missing package name' is thrown.

Source

Thrown at play-services-location/core/src/main/kotlin/org/microg/gms/location/reporting/ReportingAndroidService.kt:21

 * SPDX-License-Identifier: Apache-2.0
 */
package org.microg.gms.location.reporting

import android.os.RemoteException
import com.google.android.gms.common.api.CommonStatusCodes
import com.google.android.gms.common.internal.ConnectionInfo
import com.google.android.gms.common.internal.GetServiceRequest
import com.google.android.gms.common.internal.IGmsCallbacks
import org.microg.gms.BaseService
import org.microg.gms.common.GmsService
import org.microg.gms.common.PackageUtils
import org.microg.gms.location.manager.FEATURES

class ReportingAndroidService : BaseService("GmsLocReportingSvc", GmsService.REPORTING) {
    @Throws(RemoteException::class)
    override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) {
        val packageName = PackageUtils.getAndCheckCallingPackage(this, request.packageName)
            ?: throw IllegalArgumentException("Missing package name")
        callback.onPostInitCompleteWithConnectionInfo(
            CommonStatusCodes.SUCCESS,
            ReportingServiceInstance(this, packageName),
            ConnectionInfo().apply { features = FEATURES }
        )
    }
}

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Ensure the Google Play services client library sets packageName in GetServiceRequest before binding
  2. Update the play-services client library version on the app side so the request is built correctly
  3. Verify the calling app's manifest package matches what it passes to the API
  4. Check PackageUtils.getAndCheckCallingPackage behavior: caller UID must actually own the claimed package
Defensive patterns

Strategy: try-catch

Validate before calling

// client side: ensure package name is populated before binding
val req = GetServiceRequest().apply {
    packageName = context.packageName
    require(packageName.isNotBlank()) { "packageName required" }
}

Try / catch

try {
    bindService(...) // connection to ReportingAndroidService
} catch (e: IllegalArgumentException) {
    if (e.message == "Missing package name") {
        Log.e(TAG, "GetServiceRequest.packageName not set; update play-services client library")
    } else throw e
}

Prevention

When it happens

Trigger: A client connects to the location reporting service with request.packageName null or empty; the caller's resolved package does not match the claimed packageName so getAndCheckCallingPackage returns null.

Common situations: Hand-crafted or legacy GMS client bindings that omit packageName; mismatched/impersonated package claims; outdated Google Play services client library versions building incomplete GetServiceRequests.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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