我正在尝试使用复合控件,所以我在以下link
中尝试了此示例但是我在开始时得到了一个强制关闭,而logcat显示了很多我不理解的错误。我真的很感激任何帮助。
以下是LogCat错误
> > 08-04 13:21:43.415: ERROR/Zygote(33): setreuid() failed. errno: 2
> 08-04 13:21:53.055: ERROR/Zygote(33): setreuid() failed. errno: 17
> 08-04 13:21:55.925: ERROR/BatteryService(71): usbOnlinePath not found
> 08-04 13:21:55.925: ERROR/BatteryService(71): batteryVoltagePath not
> found 08-04 13:21:55.935: ERROR/BatteryService(71):
> batteryTemperaturePath not found 08-04 13:21:55.985:
> ERROR/SurfaceFlinger(71): Couldn't open /sys/power/wait_for_fb_sleep
> or /sys/power/wait_for_fb_wake 08-04 13:22:35.035: ERROR/EventHub(71):
> could not get driver version for /dev/input/mouse0, Not a typewriter
> 08-04 13:22:35.045: ERROR/EventHub(71): could not get driver version
> for /dev/input/mice, Not a typewriter 08-04 13:22:35.355:
> ERROR/System(71): Failure starting core service 08-04 13:22:35.355:
> ERROR/System(71): java.lang.SecurityException 08-04 13:22:35.355:
> ERROR/System(71): at android.os.BinderProxy.transact(Native
> Method) 08-04 13:22:35.355: ERROR/System(71): at
> android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
> 08-04 13:22:35.355: ERROR/System(71): at
> android.os.ServiceManager.addService(ServiceManager.java:72) 08-04
> 13:22:35.355: ERROR/System(71): at
> com.android.server.ServerThread.run(SystemServer.java:184) 08-04
> 13:22:36.675: ERROR/SoundPool(71): error loading
> /system/media/audio/ui/Effect_Tick.ogg 08-04 13:22:36.695:
> ERROR/SoundPool(71): error loading
> /system/media/audio/ui/KeypressStandard.ogg 08-04 13:22:36.695:
> ERROR/SoundPool(71): error loading
> /system/media/audio/ui/KeypressSpacebar.ogg 08-04 13:22:36.705:
> ERROR/SoundPool(71): error loading
> /system/media/audio/ui/KeypressDelete.ogg 08-04 13:22:36.715:
> ERROR/SoundPool(71): error loading
> /system/media/audio/ui/KeypressReturn.ogg 08-04 13:22:42.376:
> ERROR/ThrottleService(71): Error reading data file 08-04 13:22:42.386:
> ERROR/ThrottleService(71): Could not open GPS configuration file
> /etc/gps.conf 08-04 13:22:43.735: ERROR/logwrapper(159): executing
> /system/bin/tc failed: No such file or directory 08-04 13:22:43.825:
> ERROR/logwrapper(160): executing /system/bin/tc failed: No such file
> or directory 08-04 13:22:43.875: ERROR/logwrapper(161): executing
> /system/bin/tc failed: No such file or directory 08-04 13:22:53.155:
> ERROR/logwrapper(177): executing /system/bin/tc failed: No such file
> or directory 08-04 13:22:53.245: ERROR/logwrapper(178): executing
> /system/bin/tc failed: No such file or directory 08-04 13:22:53.345:
> ERROR/logwrapper(179): executing /system/bin/tc failed: No such file
> or directory 08-04 18:53:25.564: ERROR/Zygote(33): setreuid() failed.
> errno: 2 08-04 18:53:34.955: ERROR/Zygote(33): setreuid() failed.
> errno: 17 08-04 18:53:38.025: ERROR/BatteryService(68): usbOnlinePath
> not found 08-04 18:53:38.025: ERROR/BatteryService(68):
> batteryVoltagePath not found 08-04 18:53:38.025:
> ERROR/BatteryService(68): batteryTemperaturePath not found 08-04
> 18:53:38.075: ERROR/SurfaceFlinger(68): Couldn't open
> /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake 08-04
> 18:53:45.854: ERROR/EventHub(68): could not get driver version for
> /dev/input/mouse0, Not a typewriter 08-04 18:53:45.854:
> ERROR/EventHub(68): could not get driver version for /dev/input/mice,
> Not a typewriter 08-04 18:53:46.155: ERROR/System(68): Failure
> starting core service 08-04 18:53:46.155: ERROR/System(68):
> java.lang.SecurityException 08-04 18:53:46.155: ERROR/System(68):
> at android.os.BinderProxy.transact(Native Method) 08-04 18:53:46.155:
> ERROR/System(68): at
> android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
> 08-04 18:53:46.155: ERROR/System(68): at
> android.os.ServiceManager.addService(ServiceManager.java:72) 08-04
> 18:53:46.155: ERROR/System(68): at
> com.android.server.ServerThread.run(SystemServer.java:184) 08-04
> 18:53:47.294: ERROR/SoundPool(68): error loading
> /system/media/audio/ui/Effect_Tick.ogg 08-04 18:53:47.315:
> ERROR/SoundPool(68): error loading
> /system/media/audio/ui/KeypressStandard.ogg 08-04 18:53:47.315:
> ERROR/SoundPool(68): error loading
> /system/media/audio/ui/KeypressSpacebar.ogg 08-04 18:53:47.324:
> ERROR/SoundPool(68): error loading
> /system/media/audio/ui/KeypressDelete.ogg 08-04 18:53:47.334:
> ERROR/SoundPool(68): error loading
> /system/media/audio/ui/KeypressReturn.ogg 08-04 18:53:49.335:
> ERROR/ThrottleService(68): Could not open GPS configuration file
> /etc/gps.conf 08-04 18:53:50.555: ERROR/logwrapper(141): executing
> /system/bin/tc failed: No such file or directory 08-04 18:53:50.625:
> ERROR/logwrapper(143): executing /system/bin/tc failed: No such file
> or directory 08-04 18:53:50.745: ERROR/logwrapper(145): executing
> /system/bin/tc failed: No such file or directory 08-04 18:54:08.623:
> ERROR/HierarchicalStateMachine(68): TetherMaster - unhandledMessage:
> msg.what=3 08-04 18:54:08.733: ERROR/HierarchicalStateMachine(68):
> TetherMaster - unhandledMessage: msg.what=3 08-04 18:54:41.137:
> ERROR/MetadataRetrieverClient(34): failed to extract an album art
> 08-04 18:54:52.397: ERROR/AndroidRuntime(296): FATAL EXCEPTION: main
> 08-04 18:54:52.397: ERROR/AndroidRuntime(296):
> java.lang.RuntimeException: Unable to start activity
> ComponentInfo{pete.android.study/pete.android.study.MainActivity}:
> android.content.res.Resources$NotFoundException: Resource is not a
> Drawable (color or path): TypedValue{t=0x12/d=0x0 a=2 r=0x7f050003}
> 08-04 18:54:52.397: ERROR/AndroidRuntime(296): at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
> 08-04 18:54:52.397: ERROR/AndroidRuntime(296): at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
> 08-04 18:54:52.397: ERROR/AndroidRuntime(296): at
> android.app.ActivityThread.access$2300(ActivityThread.java:125) 08-04
> 18:54:52.397: ERROR/AndroidRuntime(296): at
> android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
> 08-04 18:54:52.397: ERROR/AndroidRuntime(296): at
> android.os.Handler.dispatchMessage(Handler.java:99) 08-04
> 18:54:52.397: ERROR/AndroidRuntime(296): at
> android.os.Looper.loop(Looper.java:123) 08-04 18:54:52.397:
> ERROR/AndroidRuntime(296): at
> android.app.ActivityThread.main(ActivityThread.java:4627) 08-04
> 18:54:52.397: ERROR/AndroidRuntime(296): at
> java.lang.reflect.Method.invokeNative(Native Method) 08-04
> 18:54:52.397: ERROR/AndroidRuntime(296): at
> java.lang.reflect.Method.invoke(Method.java:521) 08-04 18:54:52.397:
> ERROR/AndroidRuntime(296): at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
> 08-04 18:54:52.397: ERROR/AndroidRuntime(296): at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 08-04
> 18:54:52.397: ERROR/AndroidRuntime(296): at
> dalvik.system.NativeStart.main(Native Method) 08-04 18:54:52.397:
> ERROR/AndroidRuntime(296): Caused by:
> android.content.res.Resources$NotFoundException: Resource is not a
> Drawable (color or path): TypedValue{t=0x12/d=0x0 a=2 r=0x7f050003}
> 08-04 18:54:52.397: ERROR/AndroidRuntime(296): at
> android.content.res.Resources.loadDrawable(Resources.java:1681) 08-04
> 18:54:52.397: ERROR/AndroidRuntime(296): at
> android.content.res.Resources.getDrawable(Resources.java:581) 08-04
> 18:54:52.397: ERROR/AndroidRuntime(296): at
> pete.android.study.MainActivity.onCreate(MainActivity.java:20) 08-04
> 18:54:52.397: ERROR/AndroidRuntime(296): at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
> 08-04 18:54:52.397: ERROR/AndroidRuntime(296): at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
> 08-04 18:54:52.397: ERROR/AndroidRuntime(296): ... 11 more 08-04
> 18:55:17.787: ERROR/ThrottleService(68): Error reading data file
答案 0 :(得分:0)
我认为你需要看的是这一行:
java.lang.RuntimeException:无法启动活动 ComponentInfo {} pete.android.study/pete.android.study.MainActivity: android.content.res.Resources $ NotFoundException:资源不是 可绘制(颜色或路径):TypedValue {t = 0x12 / d = 0x0 a = 2 r = 0x7f050003}
和这一个:
pete.android.study.MainActivity.onCreate(MainActivity.java:20)
查看MainActivity的第20行。您正在尝试将某些内容设置为不兼容的drawable。