今天遇到这么个问题:
直接崩溃,闪退。
错误日志:
Process: com.yckj.smartdz.client, PID: 21570
android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class at android.view.LayoutInflater.inflate(LayoutInflater.java:543) at android.view.LayoutInflater.inflate(LayoutInflater.java:427) at com.yckj.smartdz.client.module.base.BaseMvpFragment.onCreateView(BaseMvpFragment.java:33) at android.support.v4.app.Fragment.performCreateView(Fragment.java:2261) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1419) at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1750) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1819) at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:797) at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2590) at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2377) at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2332) at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2209) at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:649) at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:145) at android.support.v4.view.ViewPager.populate(ViewPager.java:1238) at android.support.v4.view.ViewPager.populate(ViewPager.java:1086) at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1616) at android.view.View.measure(View.java:18811) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5952) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139) at android.view.View.measure(View.java:18811) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5952) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465) at android.widget.LinearLayout.measureVertical(LinearLayout.java:748) at android.widget.LinearLayout.onMeasure(LinearLayout.java:630) at android.view.View.measure(View.java:18811) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5952) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:18811) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5952) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465) at android.widget.LinearLayout.measureVertical(LinearLayout.java:748) at android.widget.LinearLayout.onMeasure(LinearLayout.java:630) at android.view.View.measure(View.java:18811) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5952) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2643) at android.view.View.measure(View.java:18811) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2127) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1243) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1479) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1134) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6050) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:860) at android.view.Choreographer.doCallbacks(Choreographer.java:672) at android.view.Choreographer.doFrame(Choreographer.java:608) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:846) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5441) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738) at com.android.intern 找了一天后来发现原因是:拷贝资源的时候放错了位置,shape_XXXXXXXXXXXXXX.xml 放到了一个drawable-v24 文件夹下面了导致的错误,我把shape_XXXXXXXXXXXXXX.xml这个文件剪切出来放在drawable文件夹下。ok!问题解决。 唉,还是粗心惹的祸啊。