android.content.res.Resources$NotFoundException解决方

Error


11-17 18:31:56.437: E/AndroidRuntime(13460): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f010017 a=-1} 


This is a tricky time wasting type of error that has many causes, below i will be listing some of my adventures with this error


Solution


CASE 1: If You have reference attribute in attr.xml and you have many themes, you need to fill this attribute in all of these themes


attr.xml

<attr name="schedule_icon" format="reference"/>


style.xml

<style name="MyTheme1" parent="@android :style/Theme.Holo.Dialog.NoActionBar">

<item name="schedule_icon">@drawable/clock_alarm_icon_1</item>

</style>

<style name="MyTheme2" parent="@android :style/Theme.Holo.Dialog.NoActionBar">

<item name="schedule_icon">@drawable/clock_alarm_icon_2</item>

</style>


      


CASE 2: Spelling mistake or may be the drawable is not really found in drawable folders


CASE 3: You are using an "android attribute" (ex: ?android:attr/listDivider" ) 

that is not supported by your current OS Version 


CASE 4: The theme containing your reference is not applied to the Activity (either in Manifest or by using setTheme ) that is you have an attribute reference in your activity's layout but the theme filling this attribute is not applied to the Activity 




IMPORTANT NOTE: If this error happened once, you will need to uninstall/install the App for the fix to be applied ( may be to clear some cache for App files )

来源:http://karim-ouda.blogspot.com/2013/11/androidcontentresresourcesnotfoundexcep.html

你可能感兴趣的:(android.content.res.Resources$NotFoundException解决方)