Map on Jetpack Compose: GoogleCertificatesRslt: not allowed

153 views Asked by At

Im trying to implement Jetpack Compose Map on my project. In the emulator works fine but on physical devices doesn't.

This is NOT a API_KEY problem. I tried several times with different keys and doesn't work on my current project but works on my others projects.

Im using these versions (highest to compileSDK33)

implementation 'com.google.maps.android:maps-compose:2.15.0'
implementation 'com.google.android.gms:play-services-maps:18.2.0'
implementation 'com.google.android.gms:play-services-location:21.0.1'

The version is not a problem, I created a branch to update with compileSDK and still not work.

I create a basic screen only with a map.

    val cameraPositionState = rememberCameraPositionState {
    position = CameraPosition.fromLatLngZoom(LatLng(-17.1820972, 28.2918109), 10f)
}
GoogleMap(
    modifier = Modifier
        .fillMaxWidth()
        .height(300.dp)
        .padding(top = 40.dp),
    cameraPositionState = cameraPositionState
)

And obviously I have a internet permission and

        <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="myapi" />

It's really weird I have several projects and only these fail. Maybe is for using Firebase? It's the only "bigger difference" I have. And I included sha1 and sha256 for debug and release.

2

There are 2 answers

1
Piroozeh On

You said that your map works fine on the emulator, but not on physical devices. This could be due to several reasons, such as:

• Your physical devices have a different version of Google Play Services than the emulator. You can check the version of Google Play Services on your devices by going to Settings > Apps > Google Play Services. You can also update Google Play Services by following the instructions here.

• Your physical devices have a different configuration or locale than the emulator. You can check the configuration and locale of your devices by going to Settings > System > Languages & input. You can also change the configuration and locale of your devices by following the instructions here.

• Your physical devices have a different network or firewall settings than the emulator. You can check the network and firewall settings of your devices by going to Settings > Network & internet. You can also change the network and firewall settings of your devices by following the instructions here.

To troubleshoot the issue, you can also enable the debug mode of Jetpack Compose Map by setting the configuration key maps.compose.debug to true. This will print more information about the map and the errors in the logcat.

0
Yrll On

Use the LATEST renderer of Maps SDK for Android to avoid this warning

Please note that GoogleCertificatesRslt: not allowed is just a harmless, yet annoying warning message. It does not cause or show any problems on Maps SDK functionality.

This is a pretty common concern for other Maps SDK for Android developers, so there is an ongoing entry for it in the Google Issue Tracker.

You can view and star the issue here: https://issuetracker.google.com/228091313

Please note that the Issue Tracker entry above is the authoritative source for public information regarding the aforementioned issue, and all publicly-relevant updates will be posted there.

Another thing to note also is that this issue is only reproducible with the LEGACY renderer of Google Maps SDK for Android and not on the LATEST renderer.

So to fix this, please make sure that both your aforementioned Physical and Emulator Device meet the following criterias:

  • Android 5.0 (API level 21) or later
  • 2 GB or more of data storage
  • Using Google Play services version 21.39.14 or later

Ref: https://developers.google.com/maps/documentation/android-sdk/renderer#supported-devices

You can also update your Maps SDK version into 18.2.0 and up since this uses the New Map Renderer by default (Assuming that the device requirements above are met)

For a more canonical information, I'll just quote here what the Googler said on the issue: https://issuetracker.google.com/issues/228091313#comment44

  • From our investigation so far, we believe this issue only happens on Maps SDK's LEGACY renderer, and not on the LATEST renderer.
  • You can request the LATEST renderer by calling MapsInitializer.initialize(). Please follow the guide at https://developers.google.com/maps/documentation/android-sdk/renderer.
  • Please use OnMapsSdkInitializedCallback to determine which renderer version is actually returned.
    • By default the LATEST renderer is not included in the Google Play services in devices. So even though your app requests for the LATEST renderer, the callback may show that your app is still getting the Legacy one.
      • When the LATEST renderer is requested for the first time, Google Play services will request the renderer to be downloaded from our servers. It could take some time until the LATEST renderer is downloaded and installed on the device and ready to be used. It is usually completed in minutes, but could take up to a few hours.
    • Furthermore, the LATEST renderer requires devices on Android 5.0 (API level 21) or later, having 2 GB or more of data storage, and having Google Play services version 21.39.14 or later installed.

But with that said, if you still don't plan to use the LATEST renderer, rest assured that this warning does not cause any problem with the Maps SDK functionalities. It was also mentioned on the bug that there's already an internal issue filed to remove the java.lang.SecurityException warning messages from Android log. As of this writing, there's no target release date for this. So it would be good to follow the issue for updates.