microg/GmsCore · error · IllegalArgumentException
Missing package name
Error message
Missing package name
What it means
LocationManagerService.handleServiceRequest throws IllegalArgumentException('Missing package name') when PackageUtils.getAndCheckCallingPackage returns null — i.e. the GetServiceRequest carried no/blank packageName, or the calling package could not be resolved/verified against the actual binder caller. microG requires a verified client package name before handing out the location binder.
Source
Thrown at play-services-location/core/src/main/kotlin/org/microg/gms/location/manager/LocationManagerService.kt:49
val location = intent.getParcelableExtra<Location>(EXTRA_LOCATION)
if (location != null) {
locationManager.updateNetworkLocation(location)
}
}
if (intent != null && IntentCacheManager.isCache(intent)) {
locationManager.handleCacheIntent(intent)
}
return super.onStartCommand(intent, flags, startId)
}
override fun onDestroy() {
locationManager.stop()
super.onDestroy()
}
override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService?) {
val packageName = PackageUtils.getAndCheckCallingPackage(this, request.packageName)
?: throw IllegalArgumentException("Missing package name")
locationManager.start()
callback.onPostInitCompleteWithConnectionInfo(
CommonStatusCodes.SUCCESS,
LocationManagerInstance(this, locationManager, packageName, lifecycle).asBinder(),
ConnectionInfo().apply { features = FEATURES }
)
}
override fun dump(fd: FileDescriptor?, writer: PrintWriter, args: Array<out String>?) {
super.dump(fd, writer, args)
locationManager.dump(writer)
}
companion object {
const val ACTION_REPORT_LOCATION = "org.microg.gms.location.manager.ACTION_REPORT_LOCATION"
}
}View on GitHub (pinned to 157c9d86ac)
Solutions
- Ensure the GMS client is created with a valid context so the request packageName is populated with the app's real package.
- Check that the app's package name resolves: adb shell pm list packages | grep <pkg>; reinstall if missing.
- Update the play-services-base client / microG versions so package verification (getAndCheckCallingPackage) succeeds.
Example fix
// before
// request built manually without packageName
GetServiceRequest().apply { services = ... }
// after
GetServiceRequest().apply {
packageName = context.packageName // real, resolvable package
services = ...
} Defensive patterns
Strategy: try-catch
Validate before calling
val name = PackageUtils.getAndCheckCallingPackage(context, request.packageName)
requireNotNull(name) { "Calling package could not be verified" } Type guard
fun hasVerifiedPackageName(ctx: Context, claimed: String?): Boolean =
!claimed.isNullOrBlank() && runCatching { ctx.packageManager.getPackageInfo(claimed, 0) }.isSuccess Try / catch
try {
bindLocationService(request)
} catch (e: IllegalArgumentException) {
if (e.message == "Missing package name") {
// rebuild request with context.packageName and retry binding
}
} Prevention
- Always create GMS clients from a real Activity/Application context
- Never construct GetServiceRequest manually without packageName
- Ensure the app's package resolves via PackageManager before binding
When it happens
Trigger: Binding to the location service with a GetServiceRequest whose packageName field is null or empty; calling from a process whose package cannot be resolved (e.g. shared-uid isolation contexts, instrumentation, or spoofed package name that fails PackageUtils verification).
Common situations: Client SDK builds the GetServiceRequest without setting the app package name; running under a test runner with an unusual uid; custom ROM/clone apps with mismatched package metadata; microG unable to resolve calling package because of work-profile isolation.
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
- deleteAll was set to true but keys were also provided
- Element in keys cannot be null or empty
- retrieveAll was set to true but other constraint(s) was also
- Element in keys cannot be null or empty
- UID [
AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06).
Data as JSON: /api/errors/92ce089522dc6ede.
Report an issue: GitHub.