Xml-resource datei nicht gefunden

  • 0 Antworten
  • Neuester Beitrag
Diskutiere Xml-resource datei nicht gefunden im Android App Entwicklung im Bereich Betriebssysteme & Apps.
C

computer_freak

Fortgeschrittenes Mitglied
Hallo,

Meine app stuerzt jedesmal mit der Meldung "Xml datei nicht gefunden" ab:
Code:
02-13 10:21:57.602: ERROR/AndroidRuntime(26518): FATAL EXCEPTION: main
02-13 10:21:57.602: ERROR/AndroidRuntime(26518): android.content.res.Resources$NotFoundException: File res/drawable/countryadapter_list_item_1.xml from drawable resource ID #0x7f02000d
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.content.res.Resources.loadDrawable(Resources.java:1697)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.content.res.Resources.getDrawable(Resources.java:581)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.view.View.setBackgroundResource(View.java:7446)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at x.com.CountryAdapter.getView(CountryAdapter.java:45)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.widget.AbsListView.obtainView(AbsListView.java:1427)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.widget.ListView.makeAndAddView(ListView.java:1802)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.widget.ListView.fillDown(ListView.java:727)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.widget.ListView.fillFromTop(ListView.java:784)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.widget.ListView.layoutChildren(ListView.java:1655)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.widget.AbsListView.onLayout(AbsListView.java:1259)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.view.View.layout(View.java:7088)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.view.View.layout(View.java:7088)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1249)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1125)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.widget.LinearLayout.onLayout(LinearLayout.java:1042)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.view.View.layout(View.java:7088)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.view.View.layout(View.java:7088)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.view.ViewRoot.performTraversals(ViewRoot.java:1045)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.os.Looper.loop(Looper.java:123)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.app.ActivityThread.main(ActivityThread.java:4627)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at java.lang.reflect.Method.invokeNative(Native Method)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at java.lang.reflect.Method.invoke(Method.java:521)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at dalvik.system.NativeStart.main(Native Method)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #4: <item> tag requires a 'drawable' attribute or child tag defining a drawable
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:167)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:787)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.graphics.drawable.Drawable.createFromXml(Drawable.java:728)
02-13 10:21:57.602: ERROR/AndroidRuntime(26518):     at android.content.res.Resources.loadDrawable(Resources.java:1694)
Die Fehlermeldung fuehrt mich zu
Code:
			convertView.setBackgroundResource(R.drawable.countryadapter_list_item_1);
		// byw
			convertView.setBackgroundResource(R.drawable.countryadapter_list_item_2);

Die Beiden dateien(countryadapter_list_item_1 & 2) sind Identisch, bis auf das, dass die Farben unterschiedlich sind:
Code:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

	<item android:background="#79CDCD" android:state_pressed="true" />

	<item android:background="#8DEEEE" />

</selector>



Nutze ich setBackgroundColor und uebergebe ein Color- objekt funktioniert alles Einwandfrei!