java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/core/content/ContextCompat
Thanks for stopping by to let us know something could be better!
PLEASE READ
If you have a support contract with Google, please create an issue in the support console. This will ensure a timely response.
Discover additional support services for the Google Maps Platform, including developer communities, technical guidance, and expert support at the Google Maps Platform support resources page.
If your bug or feature request is not related to this particular library, please visit the Google Maps Platform issue trackers.
Check for answers on StackOverflow with the google-maps tag.
Please be sure to include as much information as possible:
Summary
Having issue instantiating IconGenerator. Compiles ok but crashes at runtime.
Expected behavior
Adding a marker with the icon generator.
Observed behavior
Crash
Environment details
Emulator Android 8.1 Using BETA utils with Maps SDK V3.1 BETA implementation 'com.google.android.libraries.maps:maps:3.1.0-beta' implementation 'com.google.maps.android:android-maps-utils-v3:1.3.1'
Steps to reproduce
Simply try adding an instance in the onmapready callback
Code example
IconGenerator ig = new IconGenerator(DCCClientActivity.app);
ig.setStyle(IconGenerator.STYLE_WHITE);
MarkerOptions mo = new MarkerOptions()
.icon(BitmapDescriptorFactory.fromBitmap(ig.makeIcon(entry.getKey())))
.position(label_area_builder.build().getCenter())
.anchor(ig.getAnchorU(), ig.getAnchorV());
map.addMarker(mo);
Stack trace
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.dcc.std_client, PID: 21084
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/core/content/ContextCompat;
at com.google.maps.android.ui.BubbleDrawable.
Following these steps will guarantee the quickest resolution possible.
Thanks!
Have you ensured AndroidX core is explicitly listed in your Gradle dependencies list? https://developer.android.com/jetpack/androidx/releases/core
implementation "androidx.core:core:$core_version"
This is probably due to the the jetifier not being enabled. @marshallellis can you ensure that you have the following flags in your gradle.properties file?
android.useAndroidX=true
android.enableJetifier=true
Seems like this might be resolved.