在安卓上找不到java资源
我的第一个错误是通过发布应用程序的开发者控制台出现的。错误是:
java.lang.RuntimeException: Unable to start activity ComponentInfo{fetchfree.diss.ellis/fetchfree.diss.ellis.Intro}:
安卓.content.res.Resources$NotFoundException: Resource ID #0x7f030007
at 安卓.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
at 安卓.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at 安卓.app.ActivityThread.access$2300(ActivityThread.java:125)
at 安卓.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at 安卓.os.Handler.dispatchMessage(Handler.java:99)
at 安卓.os.Looper.loop(Looper.java:123)
at 安卓.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.安卓.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
at com.安卓.internal.os.ZygoteInit.main(ZygoteInit.java:629)
at dalvik.system.NativeStart.main(Native Method)
Caused by: 安卓.content.res.Resources$NotFoundException: Resource ID #0x7f030007
at 安卓.content.res.Resources.getValue(Resources.java:892)
at 安卓.content.res.Resources.loadXmlResourceParser(Resources.java:1869)
at 安卓.content.res.Resources.getLayout(Resources.java:731)
at 安卓.view.LayoutInflater.inflate(LayoutInflater.java:318)
at 安卓.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.安卓.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:210)
at 安卓.app.Activity.setContentView(Activity.java:1647)
at fetchfree.diss.ellis.Intro.onCreate(Intro.java:47)
at 安卓.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at 安卓.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
... 11 more
该应用程序在我的设备(S2、S3、S4和galaxy ace)上运行良好,emulator和无法复制该应用程序。它在#0x7f030007处引用的资源是介绍活动的my setContentView的布局文件
资源:
Layout-normal-hdpi
Layout-normal-mdpi
Layout-sw360dp
我的清单上说:
<supports-screens
安卓:largeScreens="true"
安卓:normalScreens="true"
安卓:resizeable="false"
安卓:smallScreens="false" />
# 1 楼答案
我经常看到这种情况发生,因为上传到playstore的版本与发布的apk不匹配。最好的方法是在eclipse中清理项目、构建、发布,然后将apk上传到play store。如果这种情况仍然发生,你可以查看我在搜索类似问题时收集的更多信息
1.)确保你的导入是正确的。R.java必须是本地的R.java,而不是Android。R检查一下你所有的文件
2.)确保没有将整数值传递给视图。 例如,不要这样做
但要这样做
我怀疑这是您的问题,所以请扫描您的代码以查找此类错误
编译器不会抱怨的
3.)使用这种声明方式
而不是
用于id声明
进行这些更改(如果有)、清理、构建和上传。应该有用