0

正如问题标题所述。我得到这个 logcat 错误:

10-14 15:57:54.319: E/AndroidRuntime(771): FATAL EXCEPTION: main
10-14 15:57:54.319: E/AndroidRuntime(771): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.contactmanager/com.example.contactmanager.HomeScreenActivity}: android.view.InflateException: Binary XML file line #49: Error inflating class <unknown>
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.os.Looper.loop(Looper.java:130)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.app.ActivityThread.main(ActivityThread.java:3687)
10-14 15:57:54.319: E/AndroidRuntime(771):  at java.lang.reflect.Method.invokeNative(Native Method)
10-14 15:57:54.319: E/AndroidRuntime(771):  at java.lang.reflect.Method.invoke(Method.java:507)
10-14 15:57:54.319: E/AndroidRuntime(771):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
10-14 15:57:54.319: E/AndroidRuntime(771):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
10-14 15:57:54.319: E/AndroidRuntime(771):  at dalvik.system.NativeStart.main(Native Method)
10-14 15:57:54.319: E/AndroidRuntime(771): Caused by: android.view.InflateException: Binary XML file line #49: Error inflating class <unknown>
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.view.LayoutInflater.createView(LayoutInflater.java:518)
10-14 15:57:54.319: E/AndroidRuntime(771):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
10-14 15:57:54.319: E/AndroidRuntime(771):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:209)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.app.Activity.setContentView(Activity.java:1657)
10-14 15:57:54.319: E/AndroidRuntime(771):  at com.example.contactmanager.HomeScreenActivity.onCreate(HomeScreenActivity.java:58)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
10-14 15:57:54.319: E/AndroidRuntime(771):  ... 11 more
10-14 15:57:54.319: E/AndroidRuntime(771): Caused by: java.lang.reflect.InvocationTargetException
10-14 15:57:54.319: E/AndroidRuntime(771):  at java.lang.reflect.Constructor.constructNative(Native Method)
10-14 15:57:54.319: E/AndroidRuntime(771):  at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.view.LayoutInflater.createView(LayoutInflater.java:505)
10-14 15:57:54.319: E/AndroidRuntime(771):  ... 22 more
10-14 15:57:54.319: E/AndroidRuntime(771): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x10102fd a=-1}
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.content.res.Resources.loadDrawable(Resources.java:1681)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.view.View.<init>(View.java:1951)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.view.View.<init>(View.java:1899)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.view.ViewGroup.<init>(ViewGroup.java:286)
10-14 15:57:54.319: E/AndroidRuntime(771):  at android.widget.RelativeLayout.<init>(RelativeLayout.java:173)
10-14 15:57:54.319: E/AndroidRuntime(771):  ... 25 more

为什么它不起作用?

4

1 回答 1

2

您的 Android 手机可能会阻止应用程序执行,请检查调试权限。另外,以防万一,检查你的项目的目标平台和你手机上的Android版本是否对应(至少不应该在你的手机上运行低版本。)这些只是基本检查,你可能已经做了这些即便如此,提醒一下也无妨:)

于 2013-10-14T03:26:03.940 回答