Android java.lang.NumberFormatException:无效的int:“res / drawable-hdpi / ic_menu_share.png”

时间:2013-01-23 04:01:03

标签: android android-actionbar actionbarsherlock crash-reports

昨天我们在市场上发布了一款应用程序,我发现它并没有安装在HTC /索尼爱立信手机上。我终于可以拿到HTC手机了,得到了下面的logcat,但我无法调试并解决问题

设备信息

build.board: montblanc
build.bootloader: s1
build.brand: SEMC
build.cpu_abi: armeabi-v7a
build.cpu_abi2: armeabi
build.device: LT22i
build.display: 6.1.1.B.1.54
build.fingerprint: SEMC/LT22i_1261-6006/LT22i:4.0.4/6.1.1.B.1.54/ybt3zw:user/release-keys
build.hardware: st-ericsson
build.host: BuildHost
build.id: 6.1.1.B.1.54
build.manufacturer: Sony
build.model: LT22i
build.product: LT22i_1261-6006
build.radio: unknown
build.serial: CB5121XDB7
build.tags: release-keys
build.time: 1350305827000
build.type: user
build.user: BuildUser
version.codename: REL
version.incremental: ybt3zw
version.release: 4.0.4
version.sdk_int: 15

Log Cat

01-23 00:09:35.735 E/AndroidRuntime(29152): FATAL EXCEPTION: main
01-23 00:09:35.735 E/AndroidRuntime(29152): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.m7.nomad/com.m7.nomad.SplashActivity}: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.LinearLayout
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.app.ActivityThread.access$600(ActivityThread.java:127)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.os.Looper.loop(Looper.java:137)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.app.ActivityThread.main(ActivityThread.java:4448)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at java.lang.reflect.Method.invokeNative(Native Method)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at java.lang.reflect.Method.invoke(Method.java:511)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at dalvik.system.NativeStart.main(Native Method)
01-23 00:09:35.735 E/AndroidRuntime(29152): Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.LinearLayout
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.view.LayoutInflater.createView(LayoutInflater.java:606)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2712)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2772)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.app.Activity.setContentView(Activity.java:1835)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at com.m7.nomad.SplashActivity.onCreate(SplashActivity.java:46)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.app.Activity.performCreate(Activity.java:4465)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
01-23 00:09:35.735 E/AndroidRuntime(29152):     ... 11 more
01-23 00:09:35.735 E/AndroidRuntime(29152): Caused by: java.lang.reflect.InvocationTargetException
01-23 00:09:35.735 E/AndroidRuntime(29152):     at java.lang.reflect.Constructor.constructNative(Native Method)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.view.LayoutInflater.createView(LayoutInflater.java:586)
01-23 00:09:35.735 E/AndroidRuntime(29152):     ... 25 more
01-23 00:09:35.735 E/AndroidRuntime(29152): Caused by: java.lang.NumberFormatException: Invalid int: "res/drawable-hdpi/ic_menu_share.png"
01-23 00:09:35.735 E/AndroidRuntime(29152):     at java.lang.Integer.invalidInt(Integer.java:138)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at java.lang.Integer.parse(Integer.java:375)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at java.lang.Integer.parseInt(Integer.java:366)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:123)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.content.res.TypedArray.getInt(TypedArray.java:254)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.view.View.<init>(View.java:2969)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.view.ViewGroup.<init>(ViewGroup.java:418)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.widget.LinearLayout.<init>(LinearLayout.java:178)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.widget.LinearLayout.<init>(LinearLayout.java:174)
01-23 00:09:35.735 E/AndroidRuntime(29152):     ... 28 more
01-23 00:09:36.246 E/wpa_supplicant(11724): RX ctrl_iface - hexdump_ascii(len=11):
01-23 00:09:36.246 E/wpa_supplicant(11724):      53 49 47 4e 41 4c 5f 50 4f 4c 4c                  SIGNAL_POLL     
01-23 00:09:39.239 E/wpa_supplicant(11724): RX ctrl_iface - hexdump_ascii(len=11):
01-23 00:09:39.239 E/wpa_supplicant(11724):      53 49 47 4e 41 4c 5f 50 4f 4c 4c                  SIGNAL_POLL     
01-23 00:09:41.161 E/AndroidRuntime(29212): FATAL EXCEPTION: main
01-23 00:09:41.161 E/AndroidRuntime(29212): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.m7.nomad/com.m7.nomad.SplashActivity}: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.LinearLayout
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.app.ActivityThread.access$600(ActivityThread.java:127)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.os.Looper.loop(Looper.java:137)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.app.ActivityThread.main(ActivityThread.java:4448)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at java.lang.reflect.Method.invokeNative(Native Method)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at java.lang.reflect.Method.invoke(Method.java:511)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at dalvik.system.NativeStart.main(Native Method)
01-23 00:09:41.161 E/AndroidRuntime(29212): Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.LinearLayout
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.view.LayoutInflater.createView(LayoutInflater.java:606)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2712)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2772)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.app.Activity.setContentView(Activity.java:1835)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at com.m7.nomad.SplashActivity.onCreate(SplashActivity.java:46)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.app.Activity.performCreate(Activity.java:4465)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
01-23 00:09:41.161 E/AndroidRuntime(29212):     ... 11 more
01-23 00:09:41.161 E/AndroidRuntime(29212): Caused by: java.lang.reflect.InvocationTargetException
01-23 00:09:41.161 E/AndroidRuntime(29212):     at java.lang.reflect.Constructor.constructNative(Native Method)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.view.LayoutInflater.createView(LayoutInflater.java:586)
01-23 00:09:41.161 E/AndroidRuntime(29212):     ... 25 more
01-23 00:09:41.161 E/AndroidRuntime(29212): Caused by: java.lang.NumberFormatException: Invalid int: "res/drawable-hdpi/ic_menu_share.png"
01-23 00:09:41.161 E/AndroidRuntime(29212):     at java.lang.Integer.invalidInt(Integer.java:138)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at java.lang.Integer.parse(Integer.java:375)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at java.lang.Integer.parseInt(Integer.java:366)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:123)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.content.res.TypedArray.getInt(TypedArray.java:254)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.view.View.<init>(View.java:2969)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.view.ViewGroup.<init>(ViewGroup.java:418)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.widget.LinearLayout.<init>(LinearLayout.java:178)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.widget.LinearLayout.<init>(LinearLayout.java:174)
01-23 00:09:41.161 E/AndroidRuntime(29212):     ... 28 more
01-23 00:09:42.252 E/wpa_supplicant(11724): RX ctrl_iface - hexdump_ascii(len=11):
01-23 00:09:42.252 E/wpa_supplicant(11724):      53 49 47 4e 41 4c 5f 50 4f 4c 4c                  SIGNAL_POLL     
01-23 00:09:45.255 E/wpa_supplicant(11724): RX ctrl_iface - hexdump_ascii(len=11):
01-23 00:09:45.255 E/wpa_supplicant(11724):      53 49 47 4e 41 4c 5f 50 4f 4c 4c                  SIGNAL_POLL     
01-23 00:09:48.268 E/wpa_supplicant(11724): RX ctrl_iface - hexdump_ascii(len=11):
01-23 00:09:48.268 E/wpa_supplicant(11724):      53 49 47 4e 41 4c 5f 50 4f 4c 4c                  SIGNAL_POLL     
01-23 00:09:51.261 E/wpa_supplicant(11724): RX ctrl_iface - hexdump_ascii(len=11):
01-23 00:09:51.261 E/wpa_supplicant(11724):      53 49 47 4e 41 4c 5f 50 4f 4c 4c                  SIGNAL_POLL     
01-23 00:09:52.061 E/AndroidRuntime(29272): FATAL EXCEPTION: main
01-23 00:09:52.061 E/AndroidRuntime(29272): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.m7.nomad/com.m7.nomad.SplashActivity}: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.LinearLayout
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.app.ActivityThread.access$600(ActivityThread.java:127)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.os.Looper.loop(Looper.java:137)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.app.ActivityThread.main(ActivityThread.java:4448)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at java.lang.reflect.Method.invokeNative(Native Method)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at java.lang.reflect.Method.invoke(Method.java:511)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at dalvik.system.NativeStart.main(Native Method)
01-23 00:09:52.061 E/AndroidRuntime(29272): Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.LinearLayout
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.view.LayoutInflater.createView(LayoutInflater.java:606)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2712)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2772)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.app.Activity.setContentView(Activity.java:1835)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at com.m7.nomad.SplashActivity.onCreate(SplashActivity.java:46)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.app.Activity.performCreate(Activity.java:4465)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
01-23 00:09:52.061 E/AndroidRuntime(29272):     ... 11 more
01-23 00:09:52.061 E/AndroidRuntime(29272): Caused by: java.lang.reflect.InvocationTargetException
01-23 00:09:52.061 E/AndroidRuntime(29272):     at java.lang.reflect.Constructor.constructNative(Native Method)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.view.LayoutInflater.createView(LayoutInflater.java:586)
01-23 00:09:52.061 E/AndroidRuntime(29272):     ... 25 more
01-23 00:09:52.061 E/AndroidRuntime(29272): Caused by: java.lang.NumberFormatException: Invalid int: "res/drawable-hdpi/ic_menu_share.png"
01-23 00:09:52.061 E/AndroidRuntime(29272):     at java.lang.Integer.invalidInt(Integer.java:138)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at java.lang.Integer.parse(Integer.java:375)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at java.lang.Integer.parseInt(Integer.java:366)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:123)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.content.res.TypedArray.getInt(TypedArray.java:254)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.view.View.<init>(View.java:2969)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.view.ViewGroup.<init>(ViewGroup.java:418)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.widget.LinearLayout.<init>(LinearLayout.java:178)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.widget.LinearLayout.<init>(LinearLayout.java:174)
01-23 00:09:52.061 E/AndroidRuntime(29272):     ... 28 more

XML文件(进行更改后)

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:contentDescription="Splash Screen"
    android:gravity="center"
    android:src="@drawable/splash_logo" />

更改前的XML

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/primary_color"
    android:gravity="center"
    android:orientation="vertical"
    android:textAlignment="center" >

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:contentDescription="Splash Screen"
        android:gravity="center"
        android:src="@drawable/splash_logo" />

</RelativeLayout>

1 个答案:

答案 0 :(得分:1)

请在此处发布您的xml代码。 “引起:android.view.InflateException:二进制XML文件行#24:错误膨胀类android.widget.LinearLayout”。这条线说第24行有问题。