Ijkplayer: how to use ijkplayer library

Created on 11 Aug 2016  ·  8Comments  ·  Source: bilibili/ijkplayer

When I run ijkmediademo, Error happened and program crashed. I got these lines of error:

7-06 14:06:26.913: E/AndroidRuntime(11394): FATAL EXCEPTION: main
07-06 14:06:26.913: E/AndroidRuntime(11394): Process: tv.danmaku.ijk.media.demo, PID: 11394
07-06 14:06:26.913: E/AndroidRuntime(11394): java.lang.UnsatisfiedLinkError: Couldn't load ijkffmpeg from loader dalvik.system.PathClassLoader[dexPath=/data/app/tv.danmaku.ijk.media.demo-8.apk,libraryPath=/data/app-lib/tv.danmaku.ijk.media.demo-8]: findLibrary returned null
07-06 14:06:26.913: E/AndroidRuntime(11394): at java.lang.Runtime.loadLibrary(Runtime.java:358)
07-06 14:06:26.913: E/AndroidRuntime(11394): at java.lang.System.loadLibrary(System.java:526)
07-06 14:06:26.913: E/AndroidRuntime(11394): at tv.danmaku.ijk.media.player.IjkMediaPlayer$1.loadLibrary(IjkMediaPlayer.java:86)
07-06 14:06:26.913: E/AndroidRuntime(11394): at tv.danmaku.ijk.media.player.IjkMediaPlayer.loadLibrariesOnce(IjkMediaPlayer.java:95)
07-06 14:06:26.913: E/AndroidRuntime(11394): at tv.danmaku.ijk.media.player.IjkMediaPlayer.initPlayer(IjkMediaPlayer.java:137)
07-06 14:06:26.913: E/AndroidRuntime(11394): at tv.danmaku.ijk.media.player.IjkMediaPlayer.(IjkMediaPlayer.java:133)
07-06 14:06:26.913: E/AndroidRuntime(11394): at tv.danmaku.ijk.media.player.IjkMediaPlayer.(IjkMediaPlayer.java:125)
07-06 14:06:26.913: E/AndroidRuntime(11394): at tv.danmaku.ijk.media.widget.VideoView.openVideo(VideoView.java:244)
07-06 14:06:26.913: E/AndroidRuntime(11394): at tv.danmaku.ijk.media.widget.VideoView.access$30(VideoView.java:229)
07-06 14:06:26.913: E/AndroidRuntime(11394): at tv.danmaku.ijk.media.widget.VideoView$8.surfaceCreated(VideoView.java:502)
07-06 14:06:26.913: E/AndroidRuntime(11394): at android.view.SurfaceView.updateWindow(SurfaceView.java:602)
07-06 14:06:26.913: E/AndroidRuntime(11394): at android.view.SurfaceView.access$000(SurfaceView.java:94)
07-06 14:06:26.913: E/AndroidRuntime(11394): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:183)
07-06 14:06:26.913: E/AndroidRuntime(11394): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:888)
07-06 14:06:26.913: E/AndroidRuntime(11394): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2173)
07-06 14:06:26.913: E/AndroidRuntime(11394): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1246)
07-06 14:06:26.913: E/AndroidRuntime(11394): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6567)

Most helpful comment

I added this lines to ijkplayer-example/build.gradle

Error:Execution failed for task ':ijkplayer-example:processAll32DebugResources'.
> Error: more than one library with package name 'tv.danmaku.ijk.media.player'

image

All 8 comments

Same error...

09-28 17:27:27.246 32376-32376/tv.danmaku.ijk.media.example E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.UnsatisfiedLinkError: Couldn't load ijkffmpeg from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/tv.danmaku.ijk.media.example-1.apk"],nativeLibraryDirectories=[/data/app-lib/tv.danmaku.ijk.media.example-1, /vendor/lib, /system/lib]]]: findLibrary returned null
  at java.lang.Runtime.loadLibrary(Runtime.java:355)
  at java.lang.System.loadLibrary(System.java:525)
  at tv.danmaku.ijk.media.player.IjkMediaPlayer$1.loadLibrary(IjkMediaPlayer.java:163)
  at tv.danmaku.ijk.media.player.IjkMediaPlayer.loadLibrariesOnce(IjkMediaPlayer.java:174)
  at tv.danmaku.ijk.media.example.activities.VideoActivity.onCreate(VideoActivity.java:136)
  at android.app.Activity.performCreate(Activity.java:5133)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2230)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2316)
  at android.app.ActivityThread.access$600(ActivityThread.java:150)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1298)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:213)
  at android.app.ActivityThread.main(ActivityThread.java:5225)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:525)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
  at dalvik.system.NativeStart.main(Native Method)

image

使用demo需要先编译native so
或者修改ijkplayer-example/build.gradle:

dependencies {
# required, enough for most devices.
compile 'tv.danmaku.ijk.media:ijkplayer-java:0.6.2'
compile 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.6.2'
compile 'tv.danmaku.ijk.media:ijkplayer-armv5:0.6.2'
compile 'tv.danmaku.ijk.media:ijkplayer-arm64:0.6.2'
compile 'tv.danmaku.ijk.media:ijkplayer-x86:0.6.2'
compile 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.6.2'
}

I added this lines to ijkplayer-example/build.gradle

Error:Execution failed for task ':ijkplayer-example:processAll32DebugResources'.
> Error: more than one library with package name 'tv.danmaku.ijk.media.player'

image

The log has told you what is going wrong loud and clear.

allprojects {
    repositories {
        jcenter()
    }
}

See "Android/Gradle" section in README, you need to add jcenter repository
and remove the duplicate dependencies.

@thegobot,your problem, have solved?how to solve? now i have the same problem,

@thegobot, did u solve your problem?
If u, how?

change bbuild.gradle of ijkplayer-example

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:preference-v7:23.0.1'
    compile 'com.android.support:support-annotations:23.0.1'

    compile 'com.squareup:otto:1.3.8'

//    compile project(':ijkplayer-java')
//    compile project(':ijkplayer-exo')
//
//    all32Compile project(':ijkplayer-armv5')
//    all32Compile project(':ijkplayer-armv7a')
//    all32Compile project(':ijkplayer-x86')
//
//    all64Compile project(':ijkplayer-armv5')
//    all64Compile project(':ijkplayer-armv7a')
//    all64Compile project(':ijkplayer-arm64')
//    all64Compile project(':ijkplayer-x86')
//    all64Compile project(':ijkplayer-x86_64')

     compile 'tv.danmaku.ijk.media:ijkplayer-java:0.8.4'
     compile 'tv.danmaku.ijk.media:ijkplayer-exo:0.8.4'

     all32Compile 'tv.danmaku.ijk.media:ijkplayer-armv5:0.8.4'
     all32Compile 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.4'
     all32Compile 'tv.danmaku.ijk.media:ijkplayer-x86:0.8.4'

     all64Compile 'tv.danmaku.ijk.media:ijkplayer-armv5:0.8.4'
     all64Compile 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.4'
     all64Compile 'tv.danmaku.ijk.media:ijkplayer-arm64:0.8.4'
     all64Compile 'tv.danmaku.ijk.media:ijkplayer-x86:0.8.4'
     all64Compile 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.4'

    // armv5Compile project(':player-armv5')
    // armv7aCompile project(':player-armv7a')
    // arm64Compile project(':player-arm64')
    // x86Compile project(':player-x86')
    // x86_64Compile project(':player-x86_64')
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

FloridaStream picture FloridaStream  ·  3Comments

xiaogu-space picture xiaogu-space  ·  3Comments

aslgd picture aslgd  ·  4Comments

binaryxiaobao picture binaryxiaobao  ·  4Comments

ghost picture ghost  ·  3Comments