microg/GmsCore · error · IllegalArgumentException
Missing package name
Error message
Missing package name
What it means
LocationSharingReporterApiService.handleServiceRequest throws IllegalArgumentException("Missing package name") when PackageUtils.getAndCheckCallingPackage returns null — i.e. the calling package could not be resolved or does not match the declared packageName in the GetServiceRequest.
Source
Thrown at play-services-core/src/main/kotlin/com/google/android/gms/locationsharingreporter/service/LocationSharingReporterApiService.kt:74
private const val TAG = "LocationSharingReporter"
val FEATURES = arrayOf(
Feature("LOCATION_SHARING_REPORTER", 2),
Feature("LOCATION_SHARING_REPORTER_SYNC", 1),
Feature("PERIODIC_LOCATION_SHARING_REPORTER", 1),
Feature("START_LOCATION_REPORTING", 1),
Feature("STOP_LOCATION_REPORTING", 1),
Feature("GET_REPORTING_ISSUES", 1),
Feature("UPDATE_NOTICE_STATE", 1),
Feature("LOCATION_SHARING", 1),
)
class LocationSharingReporterApiService : BaseService(TAG, GmsService.LOCATION_SHARING_REPORTER) {
override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService?) {
Log.d(TAG, "handleServiceRequest: $request")
val callingPackageName = PackageUtils.getAndCheckCallingPackage(this, request.packageName)
?: throw IllegalArgumentException("Missing package name")
PackageUtils.assertGooglePackagePermission(this, GooglePackagePermission.REPORTING)
ProfileManager.ensureInitialized(this)
callback.onPostInitCompleteWithConnectionInfo(
CommonStatusCodes.SUCCESS,
LocationSharingReporterApiServiceImpl(this, lifecycle).asBinder(),
ConnectionInfo().apply { features = FEATURES }
)
}
override fun onDestroy() {
Log.d(TAG, "onDestroy: ")
super.onDestroy()
}
}
class LocationSharingReporterApiServiceImpl(
val context: Context,
override val lifecycle: LifecycleView on GitHub (pinned to 157c9d86ac)
Solutions
- Ensure the client passes its own package name in GetServiceRequest.packageName when connecting
- Update the client's play-services location library to a version that sets packageName correctly
- Check that the calling app is properly installed and its UID resolves to a package
- Wrap service binding in error handling; the IllegalArgumentException aborts the connection by design
Example fix
// before
val request = GetServiceRequest().apply { /* packageName not set */ }
// after
val request = GetServiceRequest().apply { packageName = context.packageName } Defensive patterns
Strategy: validation
Validate before calling
val request = GetServiceRequest().apply { packageName = context.packageName }
require(request.packageName?.isNotBlank() == true) { "packageName must be set" } Try / catch
try {
bindServiceWithRequest(request)
} catch (e: IllegalArgumentException) {
Log.w(TAG, "service request rejected", e)
} Prevention
- Always set packageName to the calling app's own package in GetServiceRequest
- Keep client play-services libraries updated so packageName is populated
- Never spoof another package name when binding to GMS services
When it happens
Trigger: A client binds to the location sharing reporter GMS service with a GetServiceRequest whose packageName is null/empty, or the calling UID has no resolvable package (spoofed/mismatched request).
Common situations: Misconfigured client library versions sending an unset packageName, or malicious/broken apps impersonating another package when binding to microG services.
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
- Missing package name
- deleteAll was set to true but keys were also provided
- Element in keys cannot be null or empty
- deleteAll=true but keys are provided
- retrieveAll was set to true but other constraint(s) was also
AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06).
Data as JSON: /api/errors/ce1cf749419a93ce.
Report an issue: GitHub.