我的Android应用程序适用于三星Galaxie S2,MotoDroid,ZTE Blade和Android模拟器,但在HTC Desire上崩溃。
当我在HTC Desire上调试我的代码时,它会在Resource Not found
中抛出SetContentView(R.layout.splash_screen_layout);
异常
我删除并重新生成了Gen文件夹,但无济于事,到目前为止,该问题仅在HTC设备上重现。
这是LogCat:
01-06 05:32:58.024: ERROR/AndroidRuntime(630): FATAL EXCEPTION: main
01-06 05:32:58.024: ERROR/AndroidRuntime(630): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.relay.BA/com.relay.BA.SplashScreen}: android.content.res.Resources$NotFoundException: Resource ID #0x7f030010
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2781)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2797)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at android.app.ActivityThread.access$2300(ActivityThread.java:135)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2132)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at android.os.Handler.dispatchMessage(Handler.java:99)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at android.os.Looper.loop(Looper.java:143)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at android.app.ActivityThread.main(ActivityThread.java:4914)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at java.lang.reflect.Method.invokeNative(Native Method)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at java.lang.reflect.Method.invoke(Method.java:521)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at dalvik.system.NativeStart.main(Native Method)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030010
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at android.content.res.Resources.getValue(Resources.java:892)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at android.content.res.Resources.loadXmlResourceParser(Resources.java:1869)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at android.content.res.Resources.getLayout(Resources.java:731)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at android.view.LayoutInflater.inflate(LayoutInflater.java:318)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at android.app.Activity.setContentView(Activity.java:1654)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at com.relay.BA.SplashScreen.onCreate(SplashScreen.java:43)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1065)
01-06 05:32:58.024: ERROR/AndroidRuntime(630): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2745)
有没有人遇到过这个问题或者知道发生了什么事?
答案 0 :(得分:2)
几乎可以肯定的是,您在一个layout-*
文件夹中声明的布局是正确的,但另一个不是,并且指的是不存在的ID或类似的东西。因此,在一台设备上,也许它使用layout-large
并且很好,但在另一台设备上,它使用layout-normal
或类似的东西并失败。
答案 1 :(得分:0)
尝试删除SDCard
并重新装入。
当我无法安装或启动任何应用程序时,这个技巧在不同的设备上多次使用。