Search code examples
androidforceclose

App stopped unexpectedly when exited


My application stopped unexpectedly when I pressed the back button and needed to be forced closed. Here's the error log:

11-16 14:57:34.595: E/AndroidRuntime(4899): FATAL EXCEPTION: main
11-16 14:57:34.595: E/AndroidRuntime(4899): java.lang.IllegalStateException
11-16 14:57:34.595: E/AndroidRuntime(4899):     at android.media.MediaPlayer.getDuration(Native Method)
11-16 14:57:34.595: E/AndroidRuntime(4899):     at com.example.musicshare.AndroidBuildingMusicPlayerActivity$1.run(AndroidBuildingMusicPlayerActivity.java:337)
11-16 14:57:34.595: E/AndroidRuntime(4899):     at android.os.Handler.handleCallback(Handler.java:587)
11-16 14:57:34.595: E/AndroidRuntime(4899):     at android.os.Handler.dispatchMessage(Handler.java:92)
11-16 14:57:34.595: E/AndroidRuntime(4899):     at android.os.Looper.loop(Looper.java:123)
11-16 14:57:34.595: E/AndroidRuntime(4899):     at android.app.ActivityThread.main(ActivityThread.java:3691)
11-16 14:57:34.595: E/AndroidRuntime(4899):     at java.lang.reflect.Method.invokeNative(Native Method)
11-16 14:57:34.595: E/AndroidRuntime(4899):     at java.lang.reflect.Method.invoke(Method.java:507)
11-16 14:57:34.595: E/AndroidRuntime(4899):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
11-16 14:57:34.595: E/AndroidRuntime(4899):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
11-16 14:57:34.595: E/AndroidRuntime(4899):     at dalvik.system.NativeStart.main(Native Method)

What could be the problem?


Solution

  • See your log:

    11-12 14:21:20.080: E/AndroidRuntime(8843): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.musicshare/com.example.musicshare.ZoneActivity}; have you declared this activity in your AndroidManifest.xml?
    

    You have not declared ZoneActivity on your Android Manifest.. open your Android Manifest and add:

    <activity android:name=".ZoneActivity" />