我的Eclipse ADT环境已经设置为使用Android L进行开发。从那时起,我的资源就出现了问题。在此之前,我的应用程序工作正常,下面解释了资源。
首先,带有数字[0-9]的文件会抛出错误" Resources $ NotFoundException"以及与此相关的大量其他内容(在加载资源时未找到包等)。
现在主赛事:res / raw 当我的res / raw文件夹中没有文件时,我的应用程序就会运行。当我添加文件时,它崩溃了。有没有人有任何想法?直到那时我才会处理一个变通方法,但这非常烦人。
编辑1:这是我的R.java的一部分,其中包含app_name(抛出第一个resourcenotfoundexception)和LogCat。如果我能提供其他任何可能有用的信息,请告诉我。
编辑2:我在调试时更新。我创建了一个包含一个活动的新应用程序(由eclipse生成。我将Activity更改为不使用appcompat-v7(我的目标是API 11及更高版本),删除使用appcompat库的所有痕迹(删除app:并将主题切换为Holo.Light)。
当我在" raw"中没有文件时文件夹,应用程序运行正常。我添加了一个名为" a.txt"突然崩溃了。这必须对R.java文件做一些事情,因为" raw"在字符串之前添加,未找到的资源在字符串类中。
public static final class raw {
public static final int a=0x7f060000;
}
public static final class string {
public static final int action_settings=0x7f080018;
public static final int app_name=0x7f080001;
public static final int buildroute_subtitle=0x7f08000e;
public static final int buildroute_title=0x7f08000d;
/**
This file is automatically generated by Crashlytics to uniquely
identify individual builds of your Android application.
Do NOT modify, delete, or commit to source control!
*/
public static final int com_crashlytics_android_build_id=0x7f080000;
public static final int complaints_submission=0x7f080012;
public static final int complaints_subtitle=0x7f080008;
public static final int complaints_title=0x7f080007;
public static final int hello_world=0x7f080014;

10-21 21:09:04.809: D/DisplayManager(29904): getDisplayInfo: displayId=0, info=DisplayInfo{"Built-in Screen", app 600 x 1024, real 600 x 1024, largest app 1024 x 999, smallest app 600 x 575, 60.0 fps, rotation 0, density 160, 160.421 x 159.568 dpi, layerStack 0, type BUILT_IN, address null, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS}
10-21 21:09:04.809: D/DisplayManager(29904): getDisplayInfo: displayId=0, info=DisplayInfo{"Built-in Screen", app 600 x 1024, real 600 x 1024, largest app 1024 x 999, smallest app 600 x 575, 60.0 fps, rotation 0, density 160, 160.421 x 159.568 dpi, layerStack 0, type BUILT_IN, address null, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS}
10-21 21:09:04.809: D/DisplayManager(29904): getDisplayInfo: displayId=0, info=DisplayInfo{"Built-in Screen", app 600 x 1024, real 600 x 1024, largest app 1024 x 999, smallest app 600 x 575, 60.0 fps, rotation 0, density 160, 160.421 x 159.568 dpi, layerStack 0, type BUILT_IN, address null, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS}
10-21 21:09:04.809: D/DisplayManager(29904): getDisplayInfo: displayId=0, info=DisplayInfo{"Built-in Screen", app 600 x 1024, real 600 x 1024, largest app 1024 x 999, smallest app 600 x 575, 60.0 fps, rotation 0, density 160, 160.421 x 159.568 dpi, layerStack 0, type BUILT_IN, address null, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS}
10-21 21:09:04.819: W/ActivityThread(29904): Application com.tommcfarlin.occupantsurvey is waiting for the debugger on port 8100...
10-21 21:09:04.829: I/System.out(29904): Sending WAIT chunk
10-21 21:09:04.859: I/dalvikvm(29904): Debugger is active
10-21 21:09:05.029: I/System.out(29904): Debugger has connected
10-21 21:09:05.029: I/System.out(29904): waiting for debugger to settle...
10-21 21:09:05.229: I/System.out(29904): waiting for debugger to settle...
10-21 21:09:05.429: I/System.out(29904): waiting for debugger to settle...
10-21 21:09:05.630: I/System.out(29904): waiting for debugger to settle...
10-21 21:09:05.830: I/System.out(29904): waiting for debugger to settle...
10-21 21:09:06.040: I/System.out(29904): waiting for debugger to settle...
10-21 21:09:06.230: I/System.out(29904): waiting for debugger to settle...
10-21 21:09:06.441: I/System.out(29904): debugger has settled (1497)
10-21 21:09:06.521: W/ResourceType(29904): No known package when getting value for resource number 0x7f080001
10-21 21:09:06.551: W/PackageManager(29904): Failure retrieving text 0x7f080001 in package com.tommcfarlin.occupantsurvey
10-21 21:09:06.551: W/PackageManager(29904): android.content.res.Resources$NotFoundException: String resource ID #0x7f080001
10-21 21:09:06.551: W/PackageManager(29904): at android.content.res.Resources.getText(Resources.java:1057)
10-21 21:09:06.551: W/PackageManager(29904): at android.app.ApplicationPackageManager.getText(ApplicationPackageManager.java:1168)
10-21 21:09:06.551: W/PackageManager(29904): at android.content.pm.ComponentInfo.loadLabel(ComponentInfo.java:87)
10-21 21:09:06.551: W/PackageManager(29904): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2194)
10-21 21:09:06.551: W/PackageManager(29904): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2304)
10-21 21:09:06.551: W/PackageManager(29904): at android.app.ActivityThread.access$700(ActivityThread.java:152)
10-21 21:09:06.551: W/PackageManager(29904): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1284)
10-21 21:09:06.551: W/PackageManager(29904): at android.os.Handler.dispatchMessage(Handler.java:99)
10-21 21:09:06.551: W/PackageManager(29904): at android.os.Looper.loop(Looper.java:137)
10-21 21:09:06.551: W/PackageManager(29904): at android.app.ActivityThread.main(ActivityThread.java:5299)
10-21 21:09:06.551: W/PackageManager(29904): at java.lang.reflect.Method.invokeNative(Native Method)
10-21 21:09:06.551: W/PackageManager(29904): at java.lang.reflect.Method.invoke(Method.java:511)
10-21 21:09:06.551: W/PackageManager(29904): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
10-21 21:09:06.551: W/PackageManager(29904): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
10-21 21:09:06.551: W/PackageManager(29904): at dalvik.system.NativeStart.main(Native Method)
10-21 21:09:06.551: W/ResourceType(29904): No known package when getting value for resource number 0x7f080001
10-21 21:09:06.571: W/PackageManager(29904): Failure retrieving text 0x7f080001 in package com.tommcfarlin.occupantsurvey
10-21 21:09:06.571: W/PackageManager(29904): android.content.res.Resources$NotFoundException: String resource ID #0x7f080001
10-21 21:09:06.571: W/PackageManager(29904): at android.content.res.Resources.getText(Resources.java:1057)
10-21 21:09:06.571: W/PackageManager(29904): at android.app.ApplicationPackageManager.getText(ApplicationPackageManager.java:1168)
10-21 21:09:06.571: W/PackageManager(29904): at android.content.pm.ComponentInfo.loadLabel(ComponentInfo.java:99)
10-21 21:09:06.571: W/PackageManager(29904): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2194)
10-21 21:09:06.571: W/PackageManager(29904): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2304)
10-21 21:09:06.571: W/PackageManager(29904): at android.app.ActivityThread.access$700(ActivityThread.java:152)
10-21 21:09:06.571: W/PackageManager(29904): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1284)
10-21 21:09:06.571: W/PackageManager(29904): at android.os.Handler.dispatchMessage(Handler.java:99)
10-21 21:09:06.571: W/PackageManager(29904): at android.os.Looper.loop(Looper.java:137)
10-21 21:09:06.571: W/PackageManager(29904): at android.app.ActivityThread.main(ActivityThread.java:5299)
10-21 21:09:06.571: W/PackageManager(29904): at java.lang.reflect.Method.invokeNative(Native Method)
10-21 21:09:06.571: W/PackageManager(29904): at java.lang.reflect.Method.invoke(Method.java:511)
10-21 21:09:06.571: W/PackageManager(29904): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
10-21 21:09:06.571: W/PackageManager(29904): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
10-21 21:09:06.571: W/PackageManager(29904): at dalvik.system.NativeStart.main(Native Method)
10-21 21:09:06.581: D/DisplayManager(29904): getDisplayInfo: displayId=0, info=DisplayInfo{"Built-in Screen", app 600 x 1024, real 600 x 1024, largest app 1024 x 999, smallest app 600 x 575, 60.0 fps, rotation 0, density 160, 160.421 x 159.568 dpi, layerStack 0, type BUILT_IN, address null, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS}
10-21 21:09:06.581: D/DisplayManager(29904): getDisplayInfo: displayId=0, info=DisplayInfo{"Built-in Screen", app 600 x 1024, real 600 x 1024, largest app 1024 x 999, smallest app 600 x 575, 60.0 fps, rotation 0, density 160, 160.421 x 159.568 dpi, layerStack 0, type BUILT_IN, address null, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS}
10-21 21:09:06.591: D/DisplayManager(29904): getDisplayInfo: displayId=0, info=DisplayInfo{"Built-in Screen", app 600 x 1024, real 600 x 1024, largest app 1024 x 999, smallest app 600 x 575, 60.0 fps, rotation 0, density 160, 160.421 x 159.568 dpi, layerStack 0, type BUILT_IN, address null, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS}
10-21 21:09:06.591: W/ResourceType(29904): Invalid package identifier when getting bag for resource number 0x7f0a0001
10-21 21:09:06.601: D/DisplayManager(29904): getDisplayInfo: displayId=0, info=DisplayInfo{"Built-in Screen", app 600 x 1024, real 600 x 1024, largest app 1024 x 999, smallest app 600 x 575, 60.0 fps, rotation 0, density 160, 160.421 x 159.568 dpi, layerStack 0, type BUILT_IN, address null, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS}
10-21 21:09:06.651: W/ResourceType(29904): No known package when getting value for resource number 0x7f020025
10-21 21:09:06.651: W/PackageManager(29904): Failure retrieving resources forcom.tommcfarlin.occupantsurvey: Resource ID #0x7f020025
10-21 21:09:06.721: E/MoreInfoHPW_ViewGroup(29904): Parent view is not a TextView
10-21 21:09:06.791: D/DisplayManager(29904): getDisplayInfo: displayId=0, info=DisplayInfo{"Built-in Screen", app 600 x 1024, real 600 x 1024, largest app 1024 x 999, smallest app 600 x 575, 60.0 fps, rotation 0, density 160, 160.421 x 159.568 dpi, layerStack 0, type BUILT_IN, address null, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS}
10-21 21:09:06.791: W/ResourceType(29904): No known package when getting value for resource number 0x7f030008
10-21 21:09:07.762: D/dalvikvm(29904): threadid=1: still suspended after undo (sc=1 dc=1)
10-21 21:09:18.433: D/AndroidRuntime(29904): Shutting down VM
10-21 21:09:18.433: W/dalvikvm(29904): threadid=1: thread exiting with uncaught exception (group=0x41237ac8)
10-21 21:09:18.493: E/AndroidRuntime(29904): FATAL EXCEPTION: main
10-21 21:09:18.493: E/AndroidRuntime(29904): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tommcfarlin.occupantsurvey/com.tommcfarlin.occupantsurvey.SplashScreen}: android.content.res.Resources$NotFoundException: Resource ID #0x7f030008
10-21 21:09:18.493: E/AndroidRuntime(29904): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2250)
10-21 21:09:18.493: E/AndroidRuntime(29904): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2304)
10-21 21:09:18.493: E/AndroidRuntime(29904): at android.app.ActivityThread.access$700(ActivityThread.java:152)
10-21 21:09:18.493: E/AndroidRuntime(29904): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1284)
10-21 21:09:18.493: E/AndroidRuntime(29904): at android.os.Handler.dispatchMessage(Handler.java:99)
10-21 21:09:18.493: E/AndroidRuntime(29904): at android.os.Looper.loop(Looper.java:137)
10-21 21:09:18.493: E/AndroidRuntime(29904): at android.app.ActivityThread.main(ActivityThread.java:5299)
10-21 21:09:18.493: E/AndroidRuntime(29904): at java.lang.reflect.Method.invokeNative(Native Method)
10-21 21:09:18.493: E/AndroidRuntime(29904): at java.lang.reflect.Method.invoke(Method.java:511)
10-21 21:09:18.493: E/AndroidRuntime(29904): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
10-21 21:09:18.493: E/AndroidRuntime(29904): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
10-21 21:09:18.493: E/AndroidRuntime(29904): at dalvik.system.NativeStart.main(Native Method)
10-21 21:09:18.493: E/AndroidRuntime(29904): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030008
10-21 21:09:18.493: E/AndroidRuntime(29904): at android.content.res.Resources.getValue(Resources.java:1883)
10-21 21:09:18.493: E/AndroidRuntime(29904): at android.content.res.Resources.loadXmlResourceParser(Resources.java:3028)
10-21 21:09:18.493: E/AndroidRuntime(29904): at android.content.res.Resources.getLayout(Resources.java:1722)
10-21 21:09:18.493: E/AndroidRuntime(29904): at android.view.LayoutInflater.inflate(LayoutInflater.java:395)
10-21 21:09:18.493: E/AndroidRuntime(29904): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
10-21 21:09:18.493: E/AndroidRuntime(29904): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:360)
10-21 21:09:18.493: E/AndroidRuntime(29904): at android.app.Activity.setContentView(Activity.java:1933)
10-21 21:09:18.493: E/AndroidRuntime(29904): at com.tommcfarlin.occupantsurvey.SplashScreen.onCreate(SplashScreen.java:33)
10-21 21:09:18.493: E/AndroidRuntime(29904): at android.app.Activity.performCreate(Activity.java:5345)
10-21 21:09:18.493: E/AndroidRuntime(29904): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
10-21 21:09:18.493: E/AndroidRuntime(29904): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2213)
10-21 21:09:18.493: E/AndroidRuntime(29904): ... 11 more