microg/GmsCore · error · IllegalArgumentException
durationMillis must be greater than 0
Error message
durationMillis must be greater than 0
What it means
Builder validation in CurrentLocationRequest.Builder.setDurationMillis: the requested duration is <= 0, but a strictly positive duration is required for the location request used to derive the current location.
Source
Thrown at play-services-location/src/main/java/com/google/android/gms/location/CurrentLocationRequest.java:168
request.throttleBehavior = throttleBehavior;
request.moduleId = moduleId;
request.workSource = new WorkSource(workSource);
request.impersonation = impersonation;
return request;
}
/**
* Sets the duration in milliseconds of the location request used to derive the current location if no historical location satisfies the current
* location request. If this duration expires with no location, the current location request will return a null location. The current location request
* may fail and return a null location after a shorter duration, but never a longer duration.
* <p>
* NOTE: Internally, this duration may be capped with what the Fused Location Provider believes is a reasonable maximum duration until it is unlikely
* that any current location can be derived. This value is usually around roughly 30 seconds.
* <p>
* The default value is {@link Long#MAX_VALUE}.
*/
public CurrentLocationRequest.Builder setDurationMillis(long durationMillis) {
if (durationMillis <= 0) throw new IllegalArgumentException("durationMillis must be greater than 0");
this.durationMillis = durationMillis;
return this;
}
/**
* Sets the {@link Granularity} of locations returned for this request. This controls whether fine or coarse locations may be returned.
* <p>
* The default value is {@link Granularity#GRANULARITY_PERMISSION_LEVEL}.
*/
public CurrentLocationRequest.Builder setGranularity(@Granularity int granularity) {
GranularityUtil.checkValidGranularity(granularity);
this.granularity = granularity;
return this;
}
/**
* Sets the maximum age of any location returned for this request. A value of 0 indicates that only freshly derived locations will be returned, and no
* historical locations will ever be returned. A value {@link Long#MAX_VALUE} represents an effectively unbounded maximum age.View on GitHub (pinned to 157c9d86ac)
Solutions
- Pass a positive duration in milliseconds
- Use a sensible default duration when none is explicitly configured
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at play-services-location/src/main/java/com/google/android/gms/location/CurrentLocationRequest.java:168 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06).
Data as JSON: /api/errors/8ba5908983492942.
Report an issue: GitHub.