microg/GmsCore · error · IllegalArgumentException

Missing package name

Error message

Missing package name

What it means

AdRequestService.handleServiceRequest resolves the calling app's package name via PackageUtils.getAndCheckCallingPackage using the packageName supplied in the GetServiceRequest. If it cannot be resolved (null) — the caller is unknown, unverified, or supplied an empty/mismatched package — it throws IllegalArgumentException("Missing package name") and refuses to bind the ad service.

Source

Thrown at play-services-ads/core/src/main/kotlin/org/microg/gms/ads/AdRequestService.kt:28

import android.util.Log
import com.google.android.gms.ads.internal.ExceptionParcel
import com.google.android.gms.ads.internal.NonagonRequestParcel
import com.google.android.gms.ads.internal.request.IAdRequestService
import com.google.android.gms.ads.internal.request.INonagonStreamingResponseListener
import com.google.android.gms.common.api.CommonStatusCodes
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.utils.warnOnTransactionIssues

private const val TAG = "AdRequestService"

class AdRequestService : BaseService(TAG, GmsService.ADMOB) {
    override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) {
        val packageName = PackageUtils.getAndCheckCallingPackage(this, request.packageName)
            ?: throw IllegalArgumentException("Missing package name")
        val binder = AdRequestServiceImpl().asBinder()
        callback.onPostInitComplete(CommonStatusCodes.SUCCESS, binder, Bundle())
    }
}

class AdRequestServiceImpl : IAdRequestService.Stub() {
    override fun getAdRequest(request: NonagonRequestParcel, listener: INonagonStreamingResponseListener) {
        Log.d(TAG, "getAdRequest")
        listener.onException(ExceptionParcel().apply {
            message = "Not supported"
            code = CommonStatusCodes.INTERNAL_ERROR
        })
    }

    override fun getSignals(request: NonagonRequestParcel, listener: INonagonStreamingResponseListener) {
        Log.d(TAG, "getSignals")
        listener.onException(ExceptionParcel().apply {
            message = "Not supported"

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Ensure the client SDK fills GetServiceRequest.packageName with the app's real package name (context.packageName)
  2. Verify the calling app's package/signature is resolvable and consistent — reinstall the app if its package record is broken
  3. Update the client ads SDK and microG to matching versions so the service request is constructed correctly
  4. If you own the caller code, stop overriding packageName manually and let the SDK derive it from the context

Example fix

// before
val request = GetServiceRequest().apply { /* packageName left unset */ }
// after
val request = GetServiceRequest().apply { packageName = context.packageName }
Defensive patterns

Strategy: validation

Validate before calling

fun buildAdServiceRequest(context: Context): GetServiceRequest =
  GetServiceRequest().apply {
    packageName = context.packageName
    require(packageName.isNotBlank()) { "Calling package must be set" }
  }

Type guard

fun GetServiceRequest.hasValidPackageName(): Boolean =
  !packageName.isNullOrBlank()

Try / catch

try {
  adService.bindService(request)
} catch (e: IllegalArgumentException) {
  if (e.message == "Missing package name") {
    Log.w(TAG, "Set request.packageName from context.packageName and retry")
  } else throw e
}

Prevention

When it happens

Trigger: A client binds to the microG ADMOB (GmsService.ADMOB) service with a GetServiceRequest whose packageName is null/empty, or whose value does not match the actual calling package as verified against the OS (PackageUtils.getAndCheckCallingPackage returns null on mismatch or unresolvable caller).

Common situations: Client SDK passing a stale or spoofed packageName in the service request instead of relying on the real caller identity; app installed with a broken/unresolved package record; ad SDK and microG version mismatch causing the request to be built without the package field; security testing where the caller's signature isn't verified.

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/9eccde2bd0d56d1e. Report an issue: GitHub.