17

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.

Asha Soman
  • 1,846
  • 1
  • 18
  • 28
  • does it crash on other devices too? – Opiatefuchs Oct 18 '16 at 13:51
  • No. only in this device. I have checked with other oneplus one models.1) One Plus One(A0001) Android Version : 5.1.1, 6.0.1 OS Version : cyanogen 12.1-20151117,cyanogen 13.0-20161015-Nightly-bacon 2)One Plus One(A3003) Android Version :6.0.1 OS Version :oxygenOs 3.2.6. The app worked fine in these devices – Asha Soman Oct 18 '16 at 13:52
  • do you have installed gapp modules on your device if you put cyanogenmod on it? – Opiatefuchs Oct 18 '16 at 13:55
  • I am not sure. This is an issue reported from one of our user. So I hav n't this device. – Asha Soman Oct 18 '16 at 14:00
  • My assumption is that he hadn´t installed Google Apps during the cyanogenmod installation. If you can contact the user, ask her/him. – Opiatefuchs Oct 18 '16 at 16:50
  • 2
    There is similar issue in CyanogenMod JIRA, it looks like the issue is related to CyanogenMod Hexo theme. https://jira.cyanogenmod.org/browse/BACON-5169 – devha Oct 18 '16 at 18:46
  • 1
    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 Oct 19 '16 at 06:59
  • 1
    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 Oct 19 '16 at 07:04
  • I have also this issue, in my case this crash repeating on Lenovo - S939 device too. – walkmn Oct 19 '16 at 12:42
  • Seems like i'm having same issue too, [crashlytics link](http://crashes.to/s/35e4baace19) – blackkara Oct 20 '16 at 14:42
  • 1
    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 Oct 21 '16 at 14:16
  • As an FYI, I have a similar error and (using Crashlytics/Fabric) it seems also to be reported on the ZUK Z1 as well as on the OnePlus A0001. – Pelpotronic Oct 31 '16 at 10:25
  • I am having the same issues, reported by users. According to the time of the questions I would say it is related to some Google Services update – gatti Nov 02 '16 at 13:27

3 Answers3

6

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

Community
  • 1
  • 1
Asha Soman
  • 1,846
  • 1
  • 18
  • 28
3

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.

Murli
  • 524
  • 6
  • 11
0

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

Gabor
  • 7,352
  • 4
  • 35
  • 56