I have an Android app that has minSdkVersion set to 9. The application compiles and runs, but when it's time to display a Google Map it crashes with
android.content.res.Resources$NotFoundException: File res/drawable-mdpi-v4/maps_watermark_dark.png from drawable resource ID #0x7f02027c
Everything points to a resource missing in the play services lib.
I'm not using proguard, shrinkResources or resConfigs.
The device is a samsung/GT-S5360L/GT-S5360L:2.3.6/GINGERBREAD
Here's the relevant part of the build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
targetSdkVersion 21
minSdkVersion 9
versionCode 476
versionName "4.7.6"
}
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.1.71'
}
And here's the stacktrace I'm getting:
D/AndroidRuntime(10297): Shutting down VM
W/dalvikvm(10297): threadid=1: thread exiting with uncaught exception (group=0x40020578)
E/AndroidRuntime(10297): FATAL EXCEPTION: main
E/AndroidRuntime(10297): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.safertaxi.driver/driver.activities.driving.ActivityDriving}: android.view.InflateException: Binary XML file line #24: Error inflating class fragment
E/AndroidRuntime(10297): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
E/AndroidRuntime(10297): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
E/AndroidRuntime(10297): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime(10297): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
E/AndroidRuntime(10297): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(10297): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime(10297): at android.app.ActivityThread.main(ActivityThread.java:3687)
E/AndroidRuntime(10297): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(10297): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime(10297): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
E/AndroidRuntime(10297): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
E/AndroidRuntime(10297): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(10297): Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class fragment
E/AndroidRuntime(10297): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)
E/AndroidRuntime(10297): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
E/AndroidRuntime(10297): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
E/AndroidRuntime(10297): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
E/AndroidRuntime(10297): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
E/AndroidRuntime(10297): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
E/AndroidRuntime(10297): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
E/AndroidRuntime(10297): at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
E/AndroidRuntime(10297): at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
E/AndroidRuntime(10297): at driver.activities.driving.ActivityDriving.onCreate(ActivityDriving.java:109)
E/AndroidRuntime(10297): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime(10297): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
E/AndroidRuntime(10297): ... 11 more
E/AndroidRuntime(10297): Caused by: android.content.res.Resources$NotFoundException: File res/drawable-mdpi-v4/maps_watermark_dark.png from drawable resource ID #0x7f02027c
E/AndroidRuntime(10297): at android.content.res.Resources.loadDrawable(Resources.java:1714)
E/AndroidRuntime(10297): at android.content.res.Resources.getDrawable(Resources.java:581)
E/AndroidRuntime(10297): at com.google.maps.api.android.lib6.c.cl.<init>(Unknown Source)
E/AndroidRuntime(10297): at com.google.maps.api.android.lib6.c.cl.<init>(Unknown Source)
E/AndroidRuntime(10297): at com.google.maps.api.android.lib6.c.el.a(Unknown Source)
E/AndroidRuntime(10297): at com.google.maps.api.android.lib6.c.ab.a(Unknown Source)
E/AndroidRuntime(10297): at com.google.maps.api.android.lib6.c.aa.a(Unknown Source)
E/AndroidRuntime(10297): at com.google.android.gms.maps.internal.x.onTransact(SourceFile:107)
E/AndroidRuntime(10297): at android.os.Binder.transact(Binder.java:279)
E/AndroidRuntime(10297): at com.google.android.gms.maps.internal.IMapFragmentDelegate$a$a.onCreateView(Unknown Source)
E/AndroidRuntime(10297): at com.google.android.gms.maps.SupportMapFragment$a.onCreateView(Unknown Source)
E/AndroidRuntime(10297): at com.google.android.gms.dynamic.a$4.b(Unknown Source)
E/AndroidRuntime(10297): at com.google.android.gms.dynamic.a.a(Unknown Source)
E/AndroidRuntime(10297): at com.google.android.gms.dynamic.a.onCreateView(Unknown Source)
E/AndroidRuntime(10297): at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)
E/AndroidRuntime(10297): at driver.fragments.maps.FragmentMap.onCreateView(FragmentMap.java:37)
E/AndroidRuntime(10297): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
E/AndroidRuntime(10297): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:920)
E/AndroidRuntime(10297): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
E/AndroidRuntime(10297): at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1206)
E/AndroidRuntime(10297): at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2159)
E/AndroidRuntime(10297): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:297)
E/AndroidRuntime(10297): at android.support.v7.app.ActionBarActivity.onCreateView(ActionBarActivity.java:547)
E/AndroidRuntime(10297): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
E/AndroidRuntime(10297): ... 22 more
E/AndroidRuntime(10297): Caused by: java.io.FileNotFoundException: res/drawable-mdpi-v4/maps_watermark_dark.png
E/AndroidRuntime(10297): at android.content.res.AssetManager.openNonAsset
EDIT #1:
Issue still persists after:
EDIT #2:
This is how the map is currently loaded:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
...
<fragment
android:id="@+id/fragment_map"
android:name="driver.fragments.maps.FragmentMap"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
public final class FragmentMap extends SupportMapFragment {
@Override
public View onCreateView(LayoutInflater arg0, ViewGroup arg1, Bundle arg2) {
View view = super.onCreateView(arg0, arg1, arg2);
...
return view;
}
}
EDIT #3:
Apparently the issue is fixed by updating the version of Google Play Services installed on the device to 6.5.99. However, I can not confirm this as the device that experienced the issue broke down. I can not reproduce the issue as I can not reinstall 6.5.87 on a new device because the latest Google Play version is 6.5.99.
I see similar problem occurring here. Here many explanations are mentioned but I suggest checking the screen compatibility mode. It looks more probable as you have already taken care of min SDK.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With