I published my app and on some phones like Galaxy Nexus or HTC Explorer where my APP crashes.
I tested on many phones and app worked perfectly.
Can you explain me why is this happening and how to fix it ?
ERROR
java.lang.IllegalStateException
at android.media.MediaPlayer.isPlaying(Native Method)
at com.mario.kvizoman.SoloIgra.novopitanjce(SoloIgra.java:922)
at com.mario.kvizoman.SoloIgra.onClick(SoloIgra.java:901)
at android.view.View.performClick(View.java:2485)
at android.view.View$PerformClick.run(View.java:9080)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3768)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
at dalvik.system.NativeStart.main(Native Method)
CODE
if(reptimer!=null) {
if(reptimer.isPlaying()) {
reptimer.stop();
}
}
onCreate reptimer is
reptimer = MediaPlayer.create(SoloIgra.this, R.raw.napeto);
According to the Android documentation: "IllegalStateException if the internal player engine has not been initialized or has been released."
So ensure your MediaPlayer is initialized, and you don't use the released one.
From your code, since repTimer.isPlaying()
is getting invoked, I assume that the JAVA
repTimer
object is not NULL
. However, IllegalStateException
is triggered when the native
MediaPlayer
object is NULL
(Reference: http://androidxref.com/4.2.2_r1/xref/frameworks/base/media/jni/android_media_MediaPlayer.cpp#380 ). Hence, there is some mismatch between your JAVA
states and native
states.
P.S: You may want to check the code prior the position pasted in this question. In some earlier method call, the native object has been destroyed which is not reflected in your JAVA
object state.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With