资源未找到,但它取而代之

时间:2013-03-13 19:18:27

标签: android

我的报告向我提供了此错误,但我无法理解它是如何可能的?

   java.lang.RuntimeException: Unable to start activity ComponentInfo{net.aviascanner.aviascanner/net.aviascanner.aviascanner.ui.activities.GetCitiesActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class <unknown>
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2753)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2769)
            at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3905)
            at android.app.ActivityThread.access$2600(ActivityThread.java:129)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2121)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:143)
            at android.app.ActivityThread.main(ActivityThread.java:4717)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:521)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
            at dalvik.system.NativeStart.main(Native Method)
    Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class <unknown>
            at android.view.LayoutInflater.createView(LayoutInflater.java:513)
            at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
            at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:853)
            at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:262)
            at net.aviascanner.aviascanner.ui.activities.GetCitiesActivity.onCreate(GetCitiesActivity.java:115)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2717)
            ... 12 more
    Caused by: java.lang.reflect.InvocationTargetException
            at android.widget.EditText.<init>(EditText.java:51)
            at java.lang.reflect.Constructor.constructNative(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
            at android.view.LayoutInflater.createView(LayoutInflater.java:500)
            ... 25 more
    Caused by: android.content.res.Resources$NotFoundException: File res/drawable/selector_edittext.xml from drawable resource ID #0x7f0200c4
            at android.content.res.Resources.loadDrawable(Resources.java:1725)
            at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
            at android.view.View.<init>(View.java:1901)
            at android.widget.TextView.<init>(TextView.java:440)
            at android.widget.EditText.<init>(EditText.java:55)
            ... 29 more
    Caused by: java.lang.NullPointerException
            at android.graphics.drawable.DrawableContainer$DrawableContainerState.addChild(DrawableContainer.java:349)
            at android.graphics.drawable.StateListDrawable$StateListState.addStateSet(StateListDrawable.java:265)
            at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
            at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:796)
            at android.graphics.drawable.Drawable.createFromXml(Drawable.java:737)
            at android.content.res.Resources.loadDrawable(Resources.java:1722)
            ... 33 more
    android.view.InflateException: Binary XML file line #11: Error inflating class <unknown>
            at android.view.LayoutInflater.createView(LayoutInflater.java:513)
            at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
            at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:853)
            at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:262)
            at net.aviascanner.aviascanner.ui.activities.GetCitiesActivity.onCreate(GetCitiesActivity.java:115)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2717)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2769)
            at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3905)
            at android.app.ActivityThread.access$2600(ActivityThread.java:129)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2121)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:143)
            at android.app.ActivityThread.main(ActivityThread.java:4717)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:521)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
            at dalvik.system.NativeStart.main(Native Method)
    Caused by: java.lang.reflect.InvocationTargetException
            at android.widget.EditText.<init>(EditText.java:51)
            at java.lang.reflect.Constructor.constructNative(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
            at android.view.LayoutInflater.createView(LayoutInflater.java:500)
            ... 25 more
    Caused by: android.content.res.Resources$NotFoundException: File res/drawable/selector_edittext.xml from drawable resource ID #0x7f0200c4
            at android.content.res.Resources.loadDrawable(Resources.java:1725)
            at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
            at android.view.View.<init>(View.java:1901)
            at android.widget.TextView.<init>(TextView.java:440)
            at android.widget.EditText.<init>(EditText.java:55)
            ... 29 more
    Caused by: java.lang.NullPointerException
            at android.graphics.drawable.DrawableContainer$DrawableContainerState.addChild(DrawableContainer.java:349)
            at android.graphics.drawable.StateListDrawable$StateListState.addStateSet(StateListDrawable.java:265)
            at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
            at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:796)
            at android.graphics.drawable.Drawable.createFromXml(Drawable.java:737)
            at android.content.res.Resources.loadDrawable(Resources.java:1722)
            ... 33 more
    java.lang.reflect.InvocationTargetException
            at android.widget.EditText.<init>(EditText.java:51)
            at java.lang.reflect.Constructor.constructNative(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
            at android.view.LayoutInflater.createView(LayoutInflater.java:500)
            at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
            at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:853)
            at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:262)
            at net.aviascanner.aviascanner.ui.activities.GetCitiesActivity.onCreate(GetCitiesActivity.java:115)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2717)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2769)
            at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3905)
            at android.app.ActivityThread.access$2600(ActivityThread.java:129)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2121)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:143)
            at android.app.ActivityThread.main(ActivityThread.java:4717)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:521)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
            at dalvik.system.NativeStart.main(Native Method)
    Caused by: android.content.res.Resources$NotFoundException: File res/drawable/selector_edittext.xml from drawable resource ID #0x7f0200c4
            at android.content.res.Resources.loadDrawable(Resources.java:1725)
            at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
            at android.view.View.<init>(View.java:1901)
            at android.widget.TextView.<init>(TextView.java:440)
            at android.widget.EditText.<init>(EditText.java:55)
            ... 29 more
    Caused by: java.lang.NullPointerException
            at android.graphics.drawable.DrawableContainer$DrawableContainerState.addChild(DrawableContainer.java:349)
            at android.graphics.drawable.StateListDrawable$StateListState.addStateSet(StateListDrawable.java:265)
            at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
            at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:796)
            at android.graphics.drawable.Drawable.createFromXml(Drawable.java:737)
            at android.content.res.Resources.loadDrawable(Resources.java:1722)
            ... 33 more
    android.content.res.Resources$NotFoundException: File res/drawable/selector_edittext.xml from drawable resource ID #0x7f0200c4
            at android.content.res.Resources.loadDrawable(Resources.java:1725)
            at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
            at android.view.View.<init>(View.java:1901)
            at android.widget.TextView.<init>(TextView.java:440)
            at android.widget.EditText.<init>(EditText.java:55)
            at android.widget.EditText.<init>(EditText.java:51)
            at java.lang.reflect.Constructor.constructNative(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
            at android.view.LayoutInflater.createView(LayoutInflater.java:500)
            at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
            at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:853)
            at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:262)
            at net.aviascanner.aviascanner.ui.activities.GetCitiesActivity.onCreate(GetCitiesActivity.java:115)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2717)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2769)
            at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3905)
            at android.app.ActivityThread.access$2600(ActivityThread.java:129)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2121)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:143)
            at android.app.ActivityThread.main(ActivityThread.java:4717)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:521)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
            at dalvik.system.NativeStart.main(Native Method)
    Caused by: java.lang.NullPointerException
            at android.graphics.drawable.DrawableContainer$DrawableContainerState.addChild(DrawableContainer.java:349)
            at android.graphics.drawable.StateListDrawable$StateListState.addStateSet(StateListDrawable.java:265)
            at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
            at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:796)
            at android.graphics.drawable.Drawable.createFromXml(Drawable.java:737)
            at android.content.res.Resources.loadDrawable(Resources.java:1722)
            ... 33 more
    java.lang.NullPointerException
            at android.graphics.drawable.DrawableContainer$DrawableContainerState.addChild(DrawableContainer.java:349)
            at android.graphics.drawable.StateListDrawable$StateListState.addStateSet(StateListDrawable.java:265)
            at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
            at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:796)
            at android.graphics.drawable.Drawable.createFromXml(Drawable.java:737)
            at android.content.res.Resources.loadDrawable(Resources.java:1722)
            at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
            at android.view.View.<init>(View.java:1901)
            at android.widget.TextView.<init>(TextView.java:440)
            at android.widget.EditText.<init>(EditText.java:55)
            at android.widget.EditText.<init>(EditText.java:51)
            at java.lang.reflect.Constructor.constructNative(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
            at android.view.LayoutInflater.createView(LayoutInflater.java:500)
            at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
            at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:853)
            at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:262)
            at net.aviascanner.aviascanner.ui.activities.GetCitiesActivity.onCreate(GetCitiesActivity.java:115)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2717)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2769)
            at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3905)
            at android.app.ActivityThread.access$2600(ActivityThread.java:129)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2121)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:143)
            at android.app.ActivityThread.main(ActivityThread.java:4717)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:521)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
            at dalvik.system.NativeStart.main(Native Method)

1 个答案:

答案 0 :(得分:2)

我在我的应用程序中也发现了这个错误。在我的应用程序中,我通过在drawables的所有文件夹中制作drawables的副本来解决我的问题,即drawable-ldpi,drawable-mdpi,drawable-hdpi,drawable-xhdpi。这在我的应用程序中正常工作。希望如果你没有将drawables保存到所有提供的drawable文件夹中,这将解决你的问题。