App在其他Android设备上运行良好,只在三星Galaxy Tab 2上运行时崩溃。
认为它与不受支持的ActionBarSherlock有关,所以我已禁用所有自定义样式,但没有帮助。
完整的堆栈跟踪 -
01-01 12:05:43.480: FATAL EXCEPTION: main
01-01 12:05:43.480: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycompany.myapp/com.mycompany.MainActivity}: android.view.InflateException: Binary XML file line #26: Error inflating class android.widget.TextView
01-01 12:05:43.480: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
01-01 12:05:43.480: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
01-01 12:05:43.480: at android.app.ActivityThread.access$600(ActivityThread.java:140)
01-01 12:05:43.480: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
01-01 12:05:43.480: at android.os.Handler.dispatchMessage(Handler.java:99)
01-01 12:05:43.480: at android.os.Looper.loop(Looper.java:137)
01-01 12:05:43.480: at android.app.ActivityThread.main(ActivityThread.java:4895)
01-01 12:05:43.480: at java.lang.reflect.Method.invokeNative(Native Method)
01-01 12:05:43.480: at java.lang.reflect.Method.invoke(Method.java:511)
01-01 12:05:43.480: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
01-01 12:05:43.480: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
01-01 12:05:43.480: at dalvik.system.NativeStart.main(Native Method)
01-01 12:05:43.480: Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class android.widget.TextView
01-01 12:05:43.480: at android.view.LayoutInflater.createView(LayoutInflater.java:613)
01-01 12:05:43.480: at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
01-01 12:05:43.480: at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
01-01 12:05:43.480: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
01-01 12:05:43.480: at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
01-01 12:05:43.480: at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
01-01 12:05:43.480: at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
01-01 12:05:43.480: at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-01 12:05:43.480: at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-01 12:05:43.480: at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:306)
01-01 12:05:43.480: at com.actionbarsherlock.internal.ActionBarSherlockNative.setContentView(ActionBarSherlockNative.java:133)
01-01 12:05:43.480: at com.actionbarsherlock.app.SherlockActivity.setContentView(SherlockActivity.java:229)
01-01 12:05:43.480: at com.mycompany.myapp.MainActivity.onCreate(MainActivity.java:60)
01-01 12:05:43.480: at android.app.Activity.performCreate(Activity.java:5163)
01-01 12:05:43.480: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
01-01 12:05:43.480: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061)
01-01 12:05:43.480: ... 11 more
01-01 12:05:43.480: Caused by: java.lang.reflect.InvocationTargetException
01-01 12:05:43.480: at java.lang.reflect.Constructor.constructNative(Native Method)
01-01 12:05:43.480: at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
01-01 12:05:43.480: at android.view.LayoutInflater.createView(LayoutInflater.java:587)
01-01 12:05:43.480: ... 26 more
01-01 12:05:43.480: Caused by: java.lang.NumberFormatException: Invalid int: "20.0dip"
01-01 12:05:43.480: at java.lang.Integer.invalidInt(Integer.java:138)
01-01 12:05:43.480: at java.lang.Integer.parse(Integer.java:375)
01-01 12:05:43.480: at java.lang.Integer.parseInt(Integer.java:366)
01-01 12:05:43.480: at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:123)
01-01 12:05:43.480: at android.content.res.TypedArray.getInt(TypedArray.java:254)
01-01 12:05:43.480: at android.widget.TextView.<init>(TextView.java:997)
01-01 12:05:43.480: at android.widget.TextView.<init>(TextView.java:562)
01-01 12:05:43.480: ... 29 more
答案 0 :(得分:2)
原来这是一个三星的错误。有一个open bug,但还没有解决。
它是由我的布局XML中的android:paddingStart="20dp"
引起的。它也会发生在paddingEnd
上。
三星希望这个值是一个int,因此在尝试解析这个值时抛出异常。
我已将其删除并正确加载了应用。