17
votes

my application got crash in OnePlus one device. Following is the details of device

Oneplus One(A0001)

Cyanogen 13.1- ZNH2KAS1KN

Android 6.0.1

Api Elderberry (5)

And logcat shows error

Unable to start activity ComponentInfo{com.test/com.test.DetailsActivity}: android.view.InflateException: Binary XML file line #108: Binary XML file line #108: Error inflating class fragment -- Stack Trace -- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test/com.test.DetailsActivity}: android.view.InflateException: Binary XML file line #108: Binary XML file line #108: Error inflating class fragment at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2450) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5461) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by: android.view.InflateException: Binary XML file line #108: Binary XML file line #108: Error inflating class fragment at android.view.LayoutInflater.inflate(LayoutInflater.java:539) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppComapatDelegateImplV7.java:256) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109) at com.test.DetailsActivity.onCreate(DetailsActivity.java:313) at android.app.Activity.performCreate(Activity.java:6251) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2403) ... 9 more Caused by: android.view.InflateException: Binary XML file line #108: Error inflating class fragment at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:782) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) ... 17 more Caused by: android.content.res.Resources$NotFoundException: File /data/system/theme/icons/com.test_7f030000_0.png from drawable resource ID #0x7f030000 at android.content.res.Resources.openRawResource(Resources.java:1336) at android.content.res.Resources.openRawResource(Resources.java:1306) at maps.V.N.a(Unknown Source) at maps.D.e.a(Unknown Source) at maps.D.p.a(Unknown Source) at maps.ad.ae.a(Unknown Source) at maps.ad.t.a(Unknown Source) at maps.ad.M.a(Unknown Source) at wd.onTransact(:com.google.android.gms.DynamiteModulesB:107) at android.os.Binder.transact(Binder.java:387) at com.google.android.gms.maps.internal.IMapFragmentDelegate$zza$zza.onCreateView(Unknown Source) at com.google.android.gms.maps.SupportMapFragment$zza.onCreateView(Unknown Source) at com.google.android.gms.dynamic.zza$4.zzb(Unknown Source) at com.google.android.gms.dynamic.zza.zza(Unknown Source) at com.google.android.gms.dynamic.zza.onCreateView(Unknown Source) at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source) at com.test.fragments.CustomMapFragment.onCreateView(CustomMapFragment.java:39) at android.support.v4.app.Fragment.performCreateView(Fragment.java:1962) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1036) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1226) at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1328) at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2284) at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111) at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:314) at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:31) at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:79) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:754) ... 29 more Caused by: java.io.FileNotFoundException: /data/system/theme/icons/com.test_7f030000_0.png at android.content.res.AssetManager.openNonAssetNative(Native Method) at android.content.res.AssetManager.openNonAsset(AssetManager.java:423) at android.content.res.Resources.openRawResource(Resources.java:1333) ... 55 more

I have added the map fragment in the layout file

  <fragment
          android:id="@+id/fragment_map"
          android:name="com.test.fragments.CustomMapFragment"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_alignParentTop="true"
          android:layout_centerHorizontal="true"
          android:tag="fragment_map" />


public class CustomMapFragment extends SupportMapFragment {

    private OnTouchListener mListener;

    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        View layout = super.onCreateView(inflater, container, savedInstanceState);
        TouchableWrapper frameLayout = new TouchableWrapper(getActivity());
        ((ViewGroup) layout).addView(frameLayout,
                new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
        return layout;
    }

    public void setListener(OnTouchListener listener) {
        mListener = listener;
    }

    public interface OnTouchListener {
        void onTouch();
    }

    public class TouchableWrapper extends FrameLayout {

        public TouchableWrapper(Context context) {
            super(context);
        }

        @Override
        public boolean dispatchTouchEvent(MotionEvent event) {
            switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN:
                    mListener.onTouch();
                    break;
                case MotionEvent.ACTION_UP:
                    mListener.onTouch();
                    break;
            }
            return super.dispatchTouchEvent(event);
        }
    }
}

Let me know if anyone face the same issue and found any solution to fix this crash.

3
does it crash on other devices too?Opiatefuchs
There is similar issue in CyanogenMod JIRA, it looks like the issue is related to CyanogenMod Hexo theme. jira.cyanogenmod.org/browse/BACON-5169devha
Same thing happened to me. I've look at the resource mentioned in the stack trace (in your case, the stack trace you've provided is not enough... you need to find there the Resource ID that failed to load) Resource ID #0x7f030000. It was the mipmap icon for the application launcher. I've removed it and everything worked as expected. I think Cyanogenmod theme uses the same address as the one google maps uses or something like that that might cause collision.lionheart
I had copied all mipmap launcher icons to respective drawable folders also. But it did not work. Default google map application is working fine in the device.Asha Soman
Got the same issue. I do not really wanna go with the drawable vs. mipmap solution, since well... the mipmap folder is there for a good reason.saberrider

3 Answers

6
votes

This worked for me,Moved all app launcher icons from mipmap folders to respective drawable folders. Removed mipmap folder. Change AndroidManifest.xml android:icon="@mipmap/ic_launcher" to android:icon="@drawable/ic_launcher"

NOTE: this is not recommended by Google,but a temporary workaround

3
votes

I had a same problem on my Oneplus One, all I did is changed my device theme to default theme(system theme). I didn't knew this was the problem until I found this question here. Thanks for raising the question.

0
votes

This known bug basically went away by Google updating their Play Services. Also, it was specific to Cyanogenmod in general, not just OnePlus.