microg/GmsCore · error · IllegalArgumentException
maxUpdateAgeMillis must be greater than or equal to 0
Error message
maxUpdateAgeMillis must be greater than or equal to 0
What it means
Builder validation in CurrentLocationRequest.Builder.setMaxUpdateAgeMillis: the requested maximum age is negative, but the contract requires >= 0 (0 = only fresh fixes; Long.MAX_VALUE = effectively unbounded).
Source
Thrown at play-services-location/src/main/java/com/google/android/gms/location/CurrentLocationRequest.java:195
*/
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.
* <p>
* NOTE: This parameter applies only to historical locations. Freshly derived locations should almost always have timestamps close to the present time -
* however it is possible under unlikely conditions for location derivation to take longer than expected, in which case freshly derived locations may
* have slightly older timestamps.
* <p>
* The default value is 1 minute. Do not rely on the default value always being 1 minute as this may change without notice.
*/
public CurrentLocationRequest.Builder setMaxUpdateAgeMillis(long maxUpdateAgeMillis) {
if (maxUpdateAgeMillis < 0) throw new IllegalArgumentException("maxUpdateAgeMillis must be greater than or equal to 0");
this.maxUpdateAgeMillis = maxUpdateAgeMillis;
return this;
}
/**
* Sets the {@link Priority} of the location request used to derive the current location if no historical location satisfies the current location
* request.
* <p>
* The default value is {@link Priority#PRIORITY_BALANCED_POWER_ACCURACY}.
*/
public CurrentLocationRequest.Builder setPriority(@Priority int priority) {
PriorityUtil.checkValidPriority(priority);
this.priority = priority;
return this;
}
@Hide
public CurrentLocationRequest.Builder setBypass(boolean bypass) {View on GitHub (pinned to 157c9d86ac)
Solutions
- Clamp the value to 0 or a positive duration before calling setMaxUpdateAgeMillis
- Validate configuration input before building the request
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at play-services-location/src/main/java/com/google/android/gms/location/CurrentLocationRequest.java:195 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/dc90bdc10de2f532.
Report an issue: GitHub.