android-samples icon indicating copy to clipboard operation
android-samples copied to clipboard

[Google Maps for Android SDK] Unresolved drawable/maps_btn_zoom_down has unresolved theme attributes! Consider using Resources.getDrawable(int, Theme) or Context.getDrawable(int).

Open forceporquillo opened this issue 2 years ago • 1 comments

API

Google Maps SDK for Android

OS type and version

Android 11, Pixel Emulator

Expected behavior

When opening the map, the map should animate the camera and zoom to my current location with the use of FusedLocationProviderClient

Observed behavior

After a success Apply Changes the app recreates the MainActivity and should normally navigate to the current fragment destination where the map is inflated. Thus, this should also re-init the view of the current MapFragment, but it throws an exception and I can't resume my development even after trying to clean and rebuild.

Environment details

dependencies {
    ....
    implementation 'com.google.android.gms:play-services-maps:17.0.1'
    implementation 'com.google.maps.android:maps-ktx:3.1.0'
    implementation "com.google.android.gms:play-services-location:18.0.0"
    implementation 'com.google.android.libraries.places:places:2.4.0'
    implementation 'com.google.maps.android:android-maps-utils:2.2.6'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.4.1'
}

Steps to reproduce

If you can reproduce using the demo app in the project, it helps us troubleshoot faster.

  1. Running the app normally. It works smoothly as intended.
  2. After hitting the Apply Changes and Restart Activity buttons, it throws an exception.

Stack trace

E/AndroidRuntime: FATAL EXCEPTION: GLThread 1872
    Process: dev.forcecodes.truckme.driver, PID: 14669
    java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at com.google.maps.api.android.lib6.gmm6.vector.gl.aj.b(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150700-0):11)
        at com.google.maps.api.android.lib6.gmm6.vector.gl.aj.<init>(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150700-0):3)
        at com.google.maps.api.android.lib6.gmm6.vector.gl.g.<init>(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150700-0):18)
        at com.google.maps.api.android.lib6.gmm6.vector.bs.d(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150700-0):14)
        at com.google.maps.api.android.lib6.gmm6.vector.av.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150700-0):45)
W/Resources: Drawable com.google.android.gms.dynamite_mapsdynamite:drawable/maps_btn_zoom_down has unresolved theme attributes! Consider using Resources.getDrawable(int, Theme) or Context.getDrawable(int).
    java.lang.RuntimeException
        at android.content.res.Resources.getDrawable(Resources.java:899)
        at com.google.maps.api.android.lib6.impl.ax.m(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150700-0):5)
        at com.google.maps.api.android.lib6.impl.w.<init>(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150700-0):30)
        at com.google.maps.api.android.lib6.impl.bo.az(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150700-0):20)
        at com.google.maps.api.android.lib6.impl.cr.o(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150700-0):2)
        at com.google.android.gms.maps.internal.o.aX(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150700-0):22)
        at dx.onTransact(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150700-0):4)
        at android.os.Binder.transact(Binder.java:1043)
        at com.google.android.gms.internal.maps.zza.zzH(com.google.android.gms:play-services-maps@@17.0.1:2)
        at com.google.android.gms.maps.internal.zzk.onCreateView(com.google.android.gms:play-services-maps@@17.0.1:5)
        at com.google.android.gms.maps.zzau.onCreateView(com.google.android.gms:play-services-maps@@17.0.1:7)
        at com.google.android.gms.dynamic.zae.zaa(com.google.android.gms:play-services-base@@17.5.0:4)
        at com.google.android.gms.dynamic.DeferredLifecycleHelper.zaa(com.google.android.gms:play-services-base@@17.5.0:9)
        at com.google.android.gms.dynamic.DeferredLifecycleHelper.onCreateView(com.google.android.gms:play-services-base@@17.5.0:25)
        at com.google.android.gms.maps.SupportMapFragment.onCreateView(com.google.android.gms:play-services-maps@@17.0.1:1)
        at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2993)
        at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:522)
        at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261)
        at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:113)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1362)
        at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2829)
        at androidx.fragment.app.FragmentManager.dispatchViewCreated(FragmentManager.java:2765)
        at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3018)
        at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:550)
        at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261)
        at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1828)
        at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1752)
        at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1689)
        at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:488)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Thanks!

forceporquillo avatar Nov 07 '21 13:11 forceporquillo

Same here after apply code changes, after reinstalling app everything fine

SamYStudiO avatar Dec 08 '21 15:12 SamYStudiO

Hi @forceporquillo ,

The crash does not seem to happen because of the issue happening in the title of the issue, but because of this section:

Process: dev.forcecodes.truckme.driver, PID: 14669
    java.lang.NullPointerException: Attempt to invoke virtual

If this is still happening, could you paste the relevant snippet so I can check it out? Thanks!

kikoso avatar Dec 05 '22 13:12 kikoso

Was a solution found for this?

kaylemnicee avatar Apr 07 '24 05:04 kaylemnicee