一:首先看一下log
Process: com.android.setupwizard
Flags: 0x38c8be44
Package: com.android.setupwizard v23 (6.0.1)
Build: Android/msm8953_64/msm8953_64:6.0.1/MMB29M/uiprj05281123:userdebug/test-keys
java.lang.ArrayIndexOutOfBoundsException: length=5; index=5
at android.util.PathParser$PathDataNode.addCommand(PathParser.java:449)
at android.util.PathParser$PathDataNode.nodesToPath(PathParser.java:286)
at android.graphics.drawable.VectorDrawable$VPath.toPath(VectorDrawable.java:1428)
at android.graphics.drawable.VectorDrawable$VPathRenderer.drawPath(VectorDrawable.java:1083)
at android.graphics.drawable.VectorDrawable$VPathRenderer.drawGroupTree(VectorDrawable.java:1057)
at android.graphics.drawable.VectorDrawable$VPathRenderer.draw(VectorDrawable.java:1065)
at android.graphics.drawable.VectorDrawable$VectorDrawableState.updateCachedBitmap(VectorDrawable.java:829)
at android.graphics.drawable.VectorDrawable.draw(VectorDrawable.java:323)
at android.graphics.drawable.DrawableContainer.draw(DrawableContainer.java:81)
at android.graphics.drawable.LayerDrawable.draw(LayerDrawable.java:916)
at android.widget.ImageView.onDraw(ImageView.java:1228)
at android.view.View.draw(View.java:16195)
at android.view.View.updateDisplayListIfDirty(View.java:15192)
at android.view.View.draw(View.java:15965)
at android.view.ViewGroup.drawChild(ViewGroup.java:3610)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3400)
at android.view.View.updateDisplayListIfDirty(View.java:15187)
at android.view.View.draw(View.java:15965)
at android.view.ViewGroup.drawChild(ViewGroup.java:3610)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3400)
at android.view.View.draw(View.java:16198)
at android.view.View.updateDisplayListIfDirty(View.java:15192)
at android.view.View.draw(View.java:15965)
at android.view.ViewGroup.drawChild(ViewGroup.java:3610)
at android.widget.ListView.drawChild(ListView.java:3418)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3400)
at android.widget.AbsListView.dispatchDraw(AbsListView.java:2615)
at android.widget.ListView.dispatchDraw(ListView.java:3413)
at android.view.View.draw(View.java:16198)
at android.widget.AbsListView.draw(AbsListView.java:4166)
at android.view.View.updateDisplayListIfDirty(View.java:15192)
at android.view.View.draw(View.java:15965)
at android.view.ViewGroup.drawChild(ViewGroup.java:3610)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3400)
at android.view.View.draw(View.java:16198)
at android.view.View.updateDisplayListIfDirty(View.java:15192)
at android.view.View.draw(View.java:15965)
at android.view.ViewGroup.drawChild(ViewGroup.java:3610)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3400)
at android.view.View.draw(View.java:16198)
at android.support.v4.view.ViewPager.draw(ViewPager.java:2259)
at android.view.View.updateDisplayListIfDirty(View.java:15192)
at android.view.View.draw(View.java:15965)
at android.view.ViewGroup.drawChild(ViewGroup.java:3610)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3400)
at android.view.View.updateDisplayListIfDirty(View.java:15187)
at android.view.View.draw(View.java:15965)
at android.view.ViewGroup.drawChild(ViewGroup.java:3610)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3400)
at android.view.View.updateDisplayListIfDirty(View.java:15187)
at android.view.View.draw(View.java:15965)
at android.view.ViewGroup.drawChild(ViewGroup.java:3610)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3400)
at android.view.View.updateDisplayListIfDirty(View.java:15187)
at android.view.View.draw(View.java:15965)
at android.view.ViewGroup.drawChild(ViewGroup.java:3610)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3400)
at android.view.View.updateDisplayListIfDirty(View.java:15187)
at android.view.View.draw(View.java:15965)
at android.view.ViewGroup.drawChild(ViewGroup.java:3610)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3400)
at android.view.View.draw(View.java:16198)
at com.android.internal.policy.PhoneWindow$DecorView.draw(PhoneWindow.java:2690)
at android.view.View.updateDisplayListIfDirty(View.java:15192)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:281)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:287)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:322)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2615)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2434)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2067)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:606)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
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:5417)
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)
解决方法:看到log后直接蒙了,因为没有知道任何跟SetupWizard相关的错误信息。搜索VectorDrawable.java错误,搜到结果如下:
http://stackoverflow.com/questions/33737192/android-vector-drawable-crash?answertab=oldest#tab-top
根据人家的提示信息可知应该是适量图的原因。
下面就看一下错误的适量图,path中换行位置错误,这里是从.换行的,应该从,换行。可能是格式化的原因导致的。
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="26"
android:width="26dp" >
<path
android:fillAlpha="0.3"
android:fillColor="#ff0000"
android:pathData="M13.1,22.0L25.6,6.5C25.1,6.1 20.3,2.1 13.0,2.1S0.
9,6.1 0.5,6.5L13.1,22.0L13.1,22.0L13.1,22.0L13.1,22.0L13.1,22.0z" />
<path
android:fillColor="#00ff00"
android:pathData="M13.1,22.0l5.5,-6.8c-0.2,-0.2 -2.3,-1.9 -5.5,-1.9s-5.3,
1.8 -5.5,1.9L13.1,22.0L13.1,22.0L13.1,22.0L13.1,22.0L13.1,22.0z" />
</vector>
正确的适量图
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="26"
android:width="26dp" >
<path
android:fillAlpha="0.3"
android:fillColor="#ff0000"
android:pathData="M13.1,22.0L25.6,6.5C25.1,6.1 20.3,2.1 13.0,2.1S0.9,
6.1 0.5,6.5L13.1,22.0L13.1,22.0L13.1,22.0L13.1,22.0L13.1,22.0z" />
<path
android:fillColor="#00ff00"
android:pathData="M13.1,22.0l5.5,-6.8c-0.2,-0.2 -2.3,-1.9 -5.5,-1.9s-5.3,
1.8 -5.5,1.9L13.1,22.0L13.1,22.0L13.1,22.0L13.1,22.0L13.1,22.0z" />
</vector>