在android 4.0.3中绑定(bind)MediaPlaybackService时抛出如下异常:
03-09 09:51:08.399: 错误/AndroidRuntime(664): java.lang.RuntimeException: 无法启动 Activity ComponentInfo{com.sudarmuthu.android.adjustvolume/com.sudarmuthu.android.adjustvolume.AdjustVolume}: java.lang.SecurityException:不允许绑定(bind)到服务 Intent { cmp=com.android.music/.MediaPlaybackService } 03-09 09:51:08.399:错误/AndroidRuntime(664):在 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956) 03-09 09:51:08.399:错误/AndroidRuntime(664):在 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 03-09 09:51:08.399:错误/AndroidRuntime(664):在 android.app.ActivityThread.access$600(ActivityThread.java:123) 03-09 09:51:08.399: 错误/AndroidRuntime (664): 在 android.app.ActivityThread$H.handleMessage (ActivityThread.java:1147) 03-09 09:51:08.399: 错误/AndroidRuntime (664): 在 android.os.Handler.dispatchMessage (Handler.java:99) 03-09 09:51:08.399: 错误/AndroidRuntime (664): 在 android.os.Looper.loop (Looper.java:137) 03-09 09:51:08.399: 错误/AndroidRuntime (664): 在 android.app.ActivityThread.main (ActivityThread.java:4424) 03-09 09:51:08.399:错误/AndroidRuntime(664):在 java.lang.reflect.Method.invokeNative( native 方法) 03-09 09:51:08.399: 错误/AndroidRuntime (664): 在 java.lang.reflect.Method.invoke (Method.java:511) 03-09 09:51:08.399:错误/AndroidRuntime(664):在 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 03-09 09:51:08.399: 错误/AndroidRuntime (664): 在 com.android.internal.os.ZygoteInit.main (ZygoteInit.java:551) 03-09 09:51:08.399:错误/AndroidRuntime(664):在 dalvik.system.NativeStart.main( native 方法) 03-09 09:51:08.399: ERROR/AndroidRuntime(664): Caused by: java.lang.SecurityException: Not allowed to bind to service Intent { cmp=com.android.music/.MediaPlaybackService } 03-09 09:51:08.399: 错误/AndroidRuntime (664): 在 android.app.ContextImpl.bindService (ContextImpl.java:1135) 03-09 09:51:08.399: 错误/AndroidRuntime (664): 在 android.content.ContextWrapper.bindService (ContextWrapper.java:370) 03-09 09:51:08.399:错误/AndroidRuntime(664):在 com.sudarmuthu.android.adjustvolume.AdjustVolume.onStart(AdjustVolume.java:153) 03-09 09:51:08.399: 错误/AndroidRuntime (664): 在 android.app.Instrumentation.callActivityOnStart (Instrumentation.java:1133) 03-09 09:51:08.399:错误/AndroidRuntime(664):在 android.app.Activity.performStart(Activity.java:4475) 03-09 09:51:08.399:错误/AndroidRuntime(664):在 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1929)
本应用在android 2.1版本中流畅运行。
任何帮助!!
最佳答案
请引用此链接 http://groups.google.com/group/android-developers/browse_thread/thread/a03ea845989a49ba , 我想这对你有帮助...
关于Android 媒体播放服务绑定(bind)导致 SecurityException?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9628927/