在第2行膨胀异常二进制Xml文件

时间:2013-06-21 13:45:55

标签: android exception exception-handling nullpointerexception

我正在使用Android提供的ADT Bundle,以前我使用ADT插件的普通eclipse,我的应用程序工作正常,但现在使用新的ADT Bundle后,我的应用程序在显示启动画面后崩溃。

这是stacktrace:

06-21 19:10:37.913: E/AndroidRuntime(4493): FATAL EXCEPTION: main
06-21 19:10:37.913: E/AndroidRuntime(4493): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.webrich.grealgebra/com.aaa.bbb.activity.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2063)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2088)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.app.ActivityThread.access$600(ActivityThread.java:126)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1168)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.os.Looper.loop(Looper.java:137)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.app.ActivityThread.main(ActivityThread.java:4561)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at java.lang.reflect.Method.invokeNative(Native Method)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at java.lang.reflect.Method.invoke(Method.java:511)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at dalvik.system.NativeStart.main(Native Method)
06-21 19:10:37.913: E/AndroidRuntime(4493): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.view.LayoutInflater.createView(LayoutInflater.java:606)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:800)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:729)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:266)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.app.Activity.setContentView(Activity.java:1881)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at com.webrich.base.activity.MainActivity.onCreation(MainActivity.java:50)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at com.webrich.base.activity.BaseActivity.onCreate(BaseActivity.java:79)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.app.Activity.performCreate(Activity.java:4637)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2027)
06-21 19:10:37.913: E/AndroidRuntime(4493):     ... 11 more
06-21 19:10:37.913: E/AndroidRuntime(4493): Caused by: java.lang.reflect.InvocationTargetException
06-21 19:10:37.913: E/AndroidRuntime(4493):     at java.lang.reflect.Constructor.constructNative(Native Method)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.view.LayoutInflater.createView(LayoutInflater.java:586)
06-21 19:10:37.913: E/AndroidRuntime(4493):     ... 26 more
06-21 19:10:37.913: E/AndroidRuntime(4493): Caused by: android.content.res.Resources$NotFoundException: File res/drawable-mdpi/navigation_tile_back.xml from drawable resource ID #0x7f020039
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.content.res.Resources.loadDrawable(Resources.java:1923)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.view.View.<init>(View.java:2812)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.view.ViewGroup.<init>(ViewGroup.java:385)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.widget.LinearLayout.<init>(LinearLayout.java:174)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.widget.LinearLayout.<init>(LinearLayout.java:170)
06-21 19:10:37.913: E/AndroidRuntime(4493):     ... 29 more
06-21 19:10:37.913: E/AndroidRuntime(4493): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #2: <bitmap> requires a valid src attribute
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.graphics.drawable.BitmapDrawable.inflate(BitmapDrawable.java:448)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:867)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.graphics.drawable.Drawable.createFromXml(Drawable.java:804)
06-21 19:10:37.913: E/AndroidRuntime(4493):     at android.content.res.Resources.loadDrawable(Resources.java:1920)
06-21 19:10:37.913: E/AndroidRuntime(4493):     ... 34 more

但同样的应用程序在正常日食中工作正常,请帮助我,我无法弄清楚为什么会发生这种情况。

修改 这是找不到它的.xml。

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:adjustViewBounds="true"
    android:scaleType="centerInside"
    android:src="@drawable/bar"
    android:tileMode="repeat" >
</bitmap>

1 个答案:

答案 0 :(得分:0)

错误日志说: <bitmap> requires a valid src attribute

所以看来你的可绘制“栏”不正确。