Ich arbeitete an meinem Android-Programm und als ich es getestet versuchte, bekam ich plötzlich einen Fehler, der "android.content.res.Resources $ NotFoundException: Resource ID # 0x7f030027" ging Die letzte große Änderung, die ich vorgenommen habe, bestand darin, die Aktionsleiste über die Support-Bibliothek hinzuzufügen, aber das funktionierte bereits. Außerdem habe ich eine neue Klasse hinzugefügt, aber selbst wenn ich die Klasse und die zugehörigen Dateien lösche, taucht der Fehler immer noch auf. Ich habe versucht, das Projekt zu säubern und Eclipse mehrmals ohne Erfolg neu zu starten.
Hier ist der Stack-Trace, falls etwas in der Übersetzung verloren gegangen:
01-21 19:05:53.125: E/AndroidRuntime(18599): FATAL EXCEPTION: main
01-21 19:05:53.125: E/AndroidRuntime(18599): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.blackhat.htmlparsingtest/com.blackhat.htmlparsingtest.MainActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f030027
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.app.ActivityThread.access$700(ActivityThread.java:143)
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241)
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.os.Handler.dispatchMessage(Handler.java:99)
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.os.Looper.loop(Looper.java:137)
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.app.ActivityThread.main(ActivityThread.java:4950)
01-21 19:05:53.125: E/AndroidRuntime(18599): at java.lang.reflect.Method.invokeNative(Native Method)
01-21 19:05:53.125: E/AndroidRuntime(18599): at java.lang.reflect.Method.invoke(Method.java:511)
01-21 19:05:53.125: E/AndroidRuntime(18599): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)
01-21 19:05:53.125: E/AndroidRuntime(18599): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
01-21 19:05:53.125: E/AndroidRuntime(18599): at dalvik.system.NativeStart.main(Native Method)
01-21 19:05:53.125: E/AndroidRuntime(18599): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030027
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.content.res.Resources.getValue(Resources.java:1026)
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2131)
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.content.res.Resources.getLayout(Resources.java:865)
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-21 19:05:53.125: E/AndroidRuntime(18599): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:309)
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.app.Activity.setContentView(Activity.java:1914)
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:216)
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.support.v7.app.ActionBarActivityDelegateICS.setContentView(ActionBarActivityDelegateICS.java:111)
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:76)
01-21 19:05:53.125: E/AndroidRuntime(18599): at com.blackhat.htmlparsingtest.MainActivity.onCreate(MainActivity.java:39)
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.app.Activity.performCreate(Activity.java:5179)
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
01-21 19:05:53.125: E/AndroidRuntime(18599): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
01-21 19:05:53.125: E/AndroidRuntime(18599): ... 11 more
Auch habe ich die R.java-Datei und die Ressource überprüft existiert auf jeden Fall, wenn auch, wie ich erwähnt das Projekt Reinigung, die R-Datei löschen und Neustart von Eclipse tut nichts. Eine Sache, die ich fühlte, sollte erwähnt werden, ist jedoch, dass ich zwei R.java-Dateien gefunden habe, eine ist in meinem Projektordner zusammen mit BuildConfig.Java. Der andere ist in android.support.v7.appcompat. Ich weiß, appcompat kann einige Probleme verursachen, so dass ich dachte, es war erwähnenswert, nur für den Fall.
Ich kann nicht einmal meinen Code wie gewohnt funktionieren lassen, so dass jede Hilfe geschätzt wird und lassen Sie mich wissen, wenn Sie weitere Informationen benötigen!
Ich würde sagen, sauberes Projekt, aber da Sie das bereits getan haben, werden wir Code benötigen, der Ihnen hilft. – Ogen
Wenn Sie android.R in Ihren Importen haben, entfernen Sie es und versuchen Sie es erneut, aber abgesehen davon, wie @Clay sagte, werden wir weitere Informationen benötigen. – Melquiades
Ok, welche Art von Code genau? Ich würde annehmen, dass Sie Code von meiner MainActivity und möglicherweise vom Stapel verfolgen müssen? – CheeseCoder