Android:无法启动Activity,资源不是一个可绘制的

时间:2011-10-06 12:05:55

标签: android resources logcat

我的错误:

01-06 03:25:28.999: ERROR/AndroidRuntime(2255): FATAL EXCEPTION: main
01-06 03:25:28.999: ERROR/AndroidRuntime(2255): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ximxim.fifteen_puzzle/com.ximxim.fifteen_puzzle.MenuActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class 
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.os.Looper.loop(Looper.java:123)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.app.ActivityThread.main(ActivityThread.java:4627)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at java.lang.reflect.Method.invokeNative(Native Method)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at java.lang.reflect.Method.invoke(Method.java:521)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at dalvik.system.NativeStart.main(Native Method)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class 
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.view.LayoutInflater.createView(LayoutInflater.java:513)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.app.Activity.setContentView(Activity.java:1647)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at com.ximxim.fifteen_puzzle.MenuActivity.onCreate(MenuActivity.java:60)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     ... 11 more
01-06 03:25:28.999: ERROR/AndroidRuntime(2255): Caused by: java.lang.reflect.InvocationTargetException
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.widget.LinearLayout.(LinearLayout.java:115)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at java.lang.reflect.Constructor.constructNative(Native Method)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.view.LayoutInflater.createView(LayoutInflater.java:500)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     ... 21 more
01-06 03:25:28.999: ERROR/AndroidRuntime(2255): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f020053 a=-1 r=0x7f020053}
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.content.res.Resources.loadDrawable(Resources.java:1681)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.view.View.(View.java:1885)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.view.View.(View.java:1834)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     at android.view.ViewGroup.(ViewGroup.java:285)
01-06 03:25:28.999: ERROR/AndroidRuntime(2255):     ... 25 more

???它意味着什么以及如何解决它:

01-06 03:25:28.999: ERROR/AndroidRuntime(2255): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f020053 a=-1 r=0x7f020053}

1 个答案:

答案 0 :(得分:0)

你的android R.java文件搞砸了或者没有重新生成。在顶部栏的Eclipse中,只需单击Project - >清理......并选择您的项目。

如果仍然无效,请尝试手动删除R.java中的gen/mypckg.com.R.java文件。