Ijkplayer: Exception only in release (UnsatisfiedLinkError)

Created on 25 Dec 2016  ·  12Comments  ·  Source: bilibili/ijkplayer

Hi, i got this exception when i run my app in release (in debug all works fine):

java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app/com.nymeros.playmx-1/lib/arm/libijksdl.so"
    at java.lang.Runtime.loadLibrary(Runtime.java:372)
    at java.lang.System.loadLibrary(System.java:1076)
    at tv.danmaku.ijk.media.player.IjkMediaPlayer$1.a(Unknown Source)
    at tv.danmaku.ijk.media.player.IjkMediaPlayer.a(Unknown Source)
    at tv.danmaku.ijk.media.player.IjkMediaPlayer.b(Unknown Source)
    at tv.danmaku.ijk.media.player.IjkMediaPlayer.<init>(Unknown Source)
    at tv.danmaku.ijk.media.player.IjkMediaPlayer.<init>(Unknown Source)
    at com.nymeros.playmx.ijkPlayer.widget.media.IjkVideoView.a(Unknown Source)
    at com.nymeros.playmx.ijkPlayer.widget.media.IjkVideoView.c(Unknown Source)
    at com.nymeros.playmx.ijkPlayer.widget.media.IjkVideoView.r(Unknown Source)
    at com.nymeros.playmx.ijkPlayer.widget.media.IjkVideoView$8.a(Unknown Source)
    at com.nymeros.playmx.ijkPlayer.widget.media.e$b.surfaceCreated(Unknown Source)
    at android.view.SurfaceView.updateWindow(SurfaceView.java:597)
    at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:179)
    at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2098)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1150)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6061)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:860)
    at android.view.Choreographer.doCallbacks(Choreographer.java:672)
    at android.view.Choreographer.doFrame(Choreographer.java:608)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:846)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5458)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)

This happens when video fragment is loaded.

I use IjkPlayer in other app when very similar code and doesn't crash.

What am i doing wrong?

Most helpful comment

add below in your proguard rules

ijkplayer

-keep class tv.danmaku.ijk.media.player.* {; }
-keep class tv.danmaku.ijk.media.player.IjkMediaPlayer{
*;
}
-keep class tv.danmaku.ijk.media.player.ffmpeg.FFmpegApi{
*;
}
it works for me

All 12 comments

It seems you haven't packed the ijk jni library.

I added this to my build.gradle:

// required, enough for most devices.
compile 'tv.danmaku.ijk.media:ijkplayer-java:0.7.5'
compile 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.7.5'

// Other ABIs: optional
compile 'tv.danmaku.ijk.media:ijkplayer-armv5:0.7.5'
//compile 'tv.danmaku.ijk.media:ijkplayer-arm64:0.7.5'
compile 'tv.danmaku.ijk.media:ijkplayer-x86:0.7.5'
//compile 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.7.5'

// ExoPlayer as IMediaPlayer: optional, experimental
compile 'tv.danmaku.ijk.media:ijkplayer-exo:0.7.5'

And copy the widget and services folders from example project to use IjkVideoView widget.

In my another app i didn't pack the ijk jni library and it works. What is this library and what should i do to pack it?

Thanks for your answer.

i got same error too!

add below in your proguard rules

ijkplayer

-keep class tv.danmaku.ijk.media.player.* {; }
-keep class tv.danmaku.ijk.media.player.IjkMediaPlayer{
*;
}
-keep class tv.danmaku.ijk.media.player.ffmpeg.FFmpegApi{
*;
}
it works for me

Of course! i forgot the fucking proguard. For this reason the exception only appears in release.

Thank you very much!

@martin90s good,it works for me too.

It works for me to, @enigmadevs @xinzhengzhang Why not close this issues?

Sorry, i forgot it

why the the fix can resolve the problem?

@martin90s

@martin90s well done! thanks

how to enable proguard in debug mode?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yuraoff picture yuraoff  ·  3Comments

yuyashuai picture yuyashuai  ·  3Comments

lingchen52 picture lingchen52  ·  3Comments

liukuiqing picture liukuiqing  ·  3Comments

binaryxiaobao picture binaryxiaobao  ·  4Comments