Hi I'm developing android application using Vitamio for playing live audio stream. When I installed the application in Sony Experia J(android 4.1.2) first time, it crashed. But when i opened it again, it started playing. So whenever i install the app for first time, the radio crashes in this device. Below is the crash log:
java.lang.UnsatisfiedLinkError: Native method not found:
io.vov.vitamio.MediaPlayer.native_init:()V
at io.vov.vitamio.MediaPlayer.native_init(Native Method)
at io.vov.vitamio.MediaPlayer.<init>(MediaPlayer.java:238)
at io.vov.vitamio.MediaPlayer.<init>(MediaPlayer.java:192)
Getting the crash at this line:
mMediaPlayer = new MediaPlayer(this);
But not getting this crash when I debug the application. So not getting the exact reason for this crash.
I know this crash occurs, when it's not able to find the library. But, When I start the app again, it plays normally. Only whe I install the new build, app crashes with the above excepton.
Does anyone know, why this is happening..?
Concerning unable to catch this while debugging, that is because of while debugging, it is way SLOWER, than not to. So a simple and dirty fix would be just setup a delay.
The root cause is: while invoking a native method, the library is supposed to loaded-already (through System.loadLibrary()).
So my best guess is MediaPlayer.native_init is invoked before it's actually loaded while doing a first time through.
Solution: checkout where it loads the .so library and make the The MediaPlayer is initiated after the loading.