Status Update
Comments
ra...@google.com <ra...@google.com>
ra...@google.com <ra...@google.com> #2
We have shared this with our product and engineering team and will update this issue with more information as it becomes available.
so...@google.com <so...@google.com> #3
Hi matsudamper971227, could you provide a bit more detail about what you expect to happen vs what is actually happening?
For example, I just ran the following code with 21.0.0 after turning location off:
SettingsClient settingsClient = LocationServices.getSettingsClient(context);
settingsClient
.checkLocationSettings(
new LocationSettingsRequest.Builder()
.addLocationRequest(new LocationRequest.Builder(PRIORITY_HIGH_ACCURACY, 0).build())
.build())
.addOnCompleteListener(
task -> {
try {
task.getResult(ApiException.class);
fail();
} catch (ApiException e) {
assertThat(e).isInstanceOf(ResolvableApiException.class);
assertThat(task.getException()).isEqualTo(e);
ResolvableApiException apiException = (ResolvableApiException) e;
assertThat(apiException.getStatus().getStatusCode()).isEqualTo(RESOLUTION_REQUIRED);
assertThat(apiException.getResolution()).isNotNull();
}
});
This completed successfully with all assertions passing. How does this differ from what you are expecting?
ma...@gmail.com <ma...@gmail.com> #4
that test is not passed in my environment.
Pass this test.
ma...@gmail.com <ma...@gmail.com> #5
I noticed the following two are the same.
ResolvableApiException#getResolution()
ApiException.getStatus().getResolution()
public class ResolvableApiException extends ApiException {
@NonNull
public PendingIntent getResolution() {
return this.getStatus().getResolution();
}
/* ~~~ */
}
resolution was not null.
The return seems to be an ApiException, not a ResolvableApiException.
ma...@gmail.com <ma...@gmail.com> #6
same problem? I didn't notice because diffrent category.
so...@google.com <so...@google.com>
so...@google.com <so...@google.com> #7
I was able to reproduce this in a prod environment, but not a debug environment. I believe this may be due to a proguard bug or misconfiguration. Investigation continues...
so...@google.com <so...@google.com> #8
Have confirmed that this was due to depending on an incorrect version of the play-services-base library. play-services-location:21.0.0 depends on play-services-base:18.0.1, when it should instead be depending on play-services-base:18.1.0. We will be deploying a new version of play-services-location (21.0.1) that has this correction. In the meantime, a work-around is simply to explicitly depend on play-services-base:18.1.0 from your project, I have confirmed that this fixes the issue.
ca...@gmail.com <ca...@gmail.com> #9
11-02 09:15:58.327 6934 6934 E AndroidRuntime: java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.FusedLocationProviderClient, but class was expected (declaration of 'com.google.android.gms.location.FusedLocationProviderClient' appears in /data/app/~~TmhSIhC5rP4Jp8uE3HMyJw==
Using play-services-base:18.1.0 did not help. Will this also be taken care in upcoming version i.e. 21.0.1 ?
Note: play-services-location:20.0.0 works fine
so...@google.com <so...@google.com> #10
No, that is an intentional change in 21.0.0 (FusedLocationProviderClient is now an interface rather than an abstract class). The major version bump indicates there may be incompatibilities between the v19 release and the v20 release. You will need to recompile your code most likely.
so...@google.com <so...@google.com> #11
play-service-location:21.0.1 is now released and I have confirmed this bug is fixed.
aq...@gmail.com <aq...@gmail.com> #12
Estoy que me rebienta una hacker con su Caos tau la tela araña .riesgo de vida del software
th...@gmail.com <th...@gmail.com> #13
as...@gmail.com <as...@gmail.com> #14
nt...@gmail.com <nt...@gmail.com> #15
so...@google.com <so...@google.com>
go...@gmail.com <go...@gmail.com> #16
go...@gmail.com <go...@gmail.com> #17
// problem
implementation "com.google.android.gms:play-services-location:21.0.1"
// no problem
implementation "com.google.android.gms:play-services-location:20.0.0"
java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.FusedLocationProviderClient, but class was expected (declaration of 'com.google.android.gms.location.FusedLocationProviderClient' appears
at com.google.android.libraries.maps.ka.zzcj.zzf(LocationSourceImpl.java:17)
at com.google.android.libraries.maps.ka.zzcj.zza(LocationSourceImpl.java:44)
at com.google.android.libraries.maps.ka.zzba.zzc(GoogleMapImpl.java:716)
at com.google.android.libraries.maps.GoogleMap.setMyLocationEnabled(GoogleMap.java:60)
at com.google.android.libraries.maps.zzak.zza(Unknown Source:2)
at com.google.android.libraries.maps.ka.zzbc.run(Unknown Source:3)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:223)
at android.os.Looper.loop(Looper.java:324)
at android.app.ActivityThread.main(ActivityThread.java:8482)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1061)
so...@google.com <so...@google.com> #18
FusedLocationProviderClient has changed from an abstract class in 20 to an interface in 21. You will need to recompile your code accordingly.
an...@gmail.com <an...@gmail.com> #19
com.google.android.gms:play-services-location:21.0.1
com.google.android.gms:play-services-base:18.01
Device details:
Google Pixel 6a, Android 13, Play Service version 23.23.16 (190400-540660214)
I had to use the suggested workaround:
val locationRequest = LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 1000).build()
val client: SettingsClient = LocationServices.getSettingsClient(context)
val builder: LocationSettingsRequest.Builder = LocationSettingsRequest
.Builder()
.addLocationRequest(locationRequest)
val gpsSettingTask: Task<LocationSettingsResponse> = client.checkLocationSettings(builder.build())
gpsSettingTask.addOnCompleteListener {locationSettingsResponseTask ->
try {
val settingsResponse = locationSettingsResponseTask.getResult(ApiException::class.java)
// request location
} catch (e: ApiException) {
when (e.statusCode) {
LocationSettingsStatusCodes.RESOLUTION_REQUIRED -> {
try {
if (e is ResolvableApiException) {
val resolvableException = e as ResolvableApiException
val intentSenderRequest = IntentSenderRequest
.Builder(resolvableException.resolution)
.build()
// request settings dialog
} else if (e.status.resolution != null) {
val intentSenderRequest = IntentSenderRequest
.Builder(e.status.resolution!!)
.build()
// request settings dialog
}
} catch (ex: Exception) {
}
}
else -> {
}
}
}
}
Description
Device Info
problem code
What was the expected result?
if take
exception.statusCode = LocationSettingsStatusCodes.RESOLUTION_REQUIRED
will be cast
exception as ResolvableApiException
What was the actual result? exception is not ResolvableApiException
Relevant logcat output
Addendum. My product code gives a different error.
Link to captured Android bug report (shared privately in Drive.)
none
Optional: Link to any screenshot(s) that demonstrate the issue (shared privately in Drive)
none