Медиаплеер закрывает приложение - PullRequest
0 голосов
/ 07 марта 2011

Я пытаюсь воспроизводить музыку в формате mp3 в моем приложении.

Способ, которым я пытаюсь это сделать:

try {
    MediaPlayer mp = new MediaPlayer();    
    AssetFileDescriptor descriptor;
    descriptor = context.getAssets().openFd("music.mp3");
    mp.setDataSource( descriptor.getFileDescriptor(), 
        descriptor.getStartOffset(), descriptor.getLength() );
    descriptor.close();
    mp.prepare();
    mp.start();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

Это приводит к тому, что в моем приложении возникает ошибка закрытия процесса.Не знаю почему, у меня не было большого опыта в попытках и ловле, так что, возможно, я написал это неправильно.

Ценю любые ответы.

Спасибо

Редактировать:

03-07 17:48:14.820: ERROR/Zygote(32): setreuid() failed. errno: 2
03-07 17:48:27.820: ERROR/Zygote(32): setreuid() failed. errno: 17
03-07 17:48:29.920: ERROR/BatteryService(58): usbOnlinePath not found
03-07 17:48:29.920: ERROR/BatteryService(58): batteryVoltagePath not found
03-07 17:48:29.920: ERROR/BatteryService(58): batteryTemperaturePath not found
03-07 17:48:29.990: ERROR/SurfaceFlinger(58): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
03-07 17:48:41.421: ERROR/EventHub(58): could not get driver version for /dev/input/mouse0, Not a typewriter
03-07 17:48:41.421: ERROR/EventHub(58): could not get driver version for /dev/input/mice, Not a typewriter
03-07 17:48:41.970: ERROR/System(58): Failure starting core service
03-07 17:48:41.970: ERROR/System(58): java.lang.SecurityException
03-07 17:48:41.970: ERROR/System(58):     at android.os.BinderProxy.transact(Native Method)
03-07 17:48:41.970: ERROR/System(58):     at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
03-07 17:48:41.970: ERROR/System(58):     at android.os.ServiceManager.addService(ServiceManager.java:72)
03-07 17:48:41.970: ERROR/System(58):     at com.android.server.ServerThread.run(SystemServer.java:184)
03-07 17:48:43.610: ERROR/SoundPool(58): error loading /system/media/audio/ui/Effect_Tick.ogg
03-07 17:48:43.620: ERROR/SoundPool(58): error loading /system/media/audio/ui/KeypressStandard.ogg
03-07 17:48:43.620: ERROR/SoundPool(58): error loading /system/media/audio/ui/KeypressSpacebar.ogg
03-07 17:48:43.620: ERROR/SoundPool(58): error loading /system/media/audio/ui/KeypressDelete.ogg
03-07 17:48:43.630: ERROR/SoundPool(58): error loading /system/media/audio/ui/KeypressReturn.ogg
03-07 17:48:48.860: ERROR/ThrottleService(58): Could not open GPS configuration file /etc/gps.conf
03-07 17:48:51.181: ERROR/logwrapper(148): executing /system/bin/tc failed: No such file or directory
03-07 17:48:51.270: ERROR/logwrapper(149): executing /system/bin/tc failed: No such file or directory
03-07 17:48:51.451: ERROR/logwrapper(150): executing /system/bin/tc failed: No such file or directory
03-07 17:49:17.422: ERROR/HierarchicalStateMachine(58): TetherMaster - unhandledMessage: msg.what=3

Редактировать новый:

03-08 17:58:42.427: ERROR/Zygote(32): setreuid() failed. errno: 2
03-08 17:58:42.427: ERROR/Zygote(32): setreuid() failed. errno: 17
03-08 17:58:42.427: ERROR/BatteryService(39): usbOnlinePath not found
03-08 17:58:42.427: ERROR/BatteryService(39): batteryVoltagePath not found
03-08 17:58:42.427: ERROR/BatteryService(39): batteryTemperaturePath not found
03-08 17:58:42.427: ERROR/SurfaceFlinger(39): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
03-08 18:00:46.559: ERROR/EventHub(39): could not get driver version for /dev/input/mouse0, Not a typewriter
03-08 18:00:46.559: ERROR/EventHub(39): could not get driver version for /dev/input/mice, Not a typewriter
03-08 18:00:46.989: ERROR/System(39): Failure starting core service
03-08 18:00:46.989: ERROR/System(39): java.lang.SecurityException
03-08 18:00:46.989: ERROR/System(39):     at android.os.BinderProxy.transact(Native Method)
03-08 18:00:46.989: ERROR/System(39):     at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
03-08 18:00:46.989: ERROR/System(39):     at android.os.ServiceManager.addService(ServiceManager.java:72)
03-08 18:00:46.989: ERROR/System(39):     at com.android.server.ServerThread.run(SystemServer.java:184)
03-08 18:00:48.669: ERROR/SoundPool(39): error loading /system/media/audio/ui/Effect_Tick.ogg
03-08 18:00:48.679: ERROR/SoundPool(39): error loading /system/media/audio/ui/KeypressStandard.ogg
03-08 18:00:48.689: ERROR/SoundPool(39): error loading /system/media/audio/ui/KeypressSpacebar.ogg
03-08 18:00:48.689: ERROR/SoundPool(39): error loading /system/media/audio/ui/KeypressDelete.ogg
03-08 18:00:48.689: ERROR/SoundPool(39): error loading /system/media/audio/ui/KeypressReturn.ogg
03-08 18:00:52.589: ERROR/ThrottleService(39): Could not open GPS configuration file /etc/gps.conf
03-08 18:00:55.440: ERROR/logwrapper(145): executing /system/bin/tc failed: No such file or directory
03-08 18:00:55.480: ERROR/logwrapper(146): executing /system/bin/tc failed: No such file or directory
03-08 18:00:55.490: ERROR/logwrapper(147): executing /system/bin/tc failed: No such file or directory
03-08 18:01:19.879: ERROR/HierarchicalStateMachine(39): TetherMaster - unhandledMessage: msg.what=3
03-08 18:02:01.523: ERROR/AndroidRuntime(273): FATAL EXCEPTION: main
03-08 18:02:01.523: ERROR/AndroidRuntime(273): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.edu/com.edu.Menu}: java.lang.NullPointerException
03-08 18:02:01.523: ERROR/AndroidRuntime(273):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
03-08 18:02:01.523: ERROR/AndroidRuntime(273):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-08 18:02:01.523: ERROR/AndroidRuntime(273):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-08 18:02:01.523: ERROR/AndroidRuntime(273):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-08 18:02:01.523: ERROR/AndroidRuntime(273):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-08 18:02:01.523: ERROR/AndroidRuntime(273):     at android.os.Looper.loop(Looper.java:123)
03-08 18:02:01.523: ERROR/AndroidRuntime(273):     at android.app.ActivityThread.main(ActivityThread.java:4627)
03-08 18:02:01.523: ERROR/AndroidRuntime(273):     at java.lang.reflect.Method.invokeNative(Native Method)
03-08 18:02:01.523: ERROR/AndroidRuntime(273):     at java.lang.reflect.Method.invoke(Method.java:521)
03-08 18:02:01.523: ERROR/AndroidRuntime(273):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-08 18:02:01.523: ERROR/AndroidRuntime(273):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-08 18:02:01.523: ERROR/AndroidRuntime(273):     at dalvik.system.NativeStart.main(Native Method)
03-08 18:02:01.523: ERROR/AndroidRuntime(273): Caused by: java.lang.NullPointerException
03-08 18:02:01.523: ERROR/AndroidRuntime(273):     at com.edu.Menu.onCreate(Menu.java:29)
03-08 18:02:01.523: ERROR/AndroidRuntime(273):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-08 18:02:01.523: ERROR/AndroidRuntime(273):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-08 18:02:01.523: ERROR/AndroidRuntime(273):     ... 11 more
...