6

I'm going to use ijkplayer github link. I downloaded this and then import it to eclipse by File > Import > General > Existing Projects to Workspace. After that I have three project:

1.ijkmediaplayer ( library )
2.ijkmediawidget ( VideoView-like interface )
3.ijkmediademo   ( Demo project )

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

07-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.<init>(IjkMediaPlayer.java:133)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at tv.danmaku.ijk.media.player.IjkMediaPlayer.<init>(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)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:803)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.view.Choreographer.doCallbacks(Choreographer.java:603)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.view.Choreographer.doFrame(Choreographer.java:573)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:789)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.os.Handler.handleCallback(Handler.java:733)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.os.Handler.dispatchMessage(Handler.java:95)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.os.Looper.loop(Looper.java:136)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.app.ActivityThread.main(ActivityThread.java:5476)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at java.lang.reflect.Method.invokeNative(Native Method)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at java.lang.reflect.Method.invoke(Method.java:515)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at dalvik.system.NativeStart.main(Native Method)

It's seems that program can't find some libraries that sets here in IjkMediaPlayer class:

public static void loadLibrariesOnce(IjkLibLoader libLoader) {
    synchronized (IjkMediaPlayer.class) {
        if (!mIsLibLoaded) {
            libLoader.loadLibrary("stlport_shared");
            libLoader.loadLibrary("ijkffmpeg");
            libLoader.loadLibrary("ijkutil");
            libLoader.loadLibrary("ijkadk");
            libLoader.loadLibrary("ijksdl");
            libLoader.loadLibrary("ijkplayer");
            mIsLibLoaded = true;
        }
    }
}

what are these libraries?

where are these libraries? ( i could not find them in projects )

How can solve this issue?

Community
  • 1
  • 1
MAY3AM
  • 1,182
  • 3
  • 17
  • 42

1 Answers1

2

Seems that you haven't built libraries which are required - you have to do it by yourself. Follow instructions under the header Build Android on the page ijkplayer github link

After successfull build process you'll get several library files (libijkffmpeg, libijkutil, libijkadk, libijksdl, libijkplayer) which will be automatically put into ijkmediaplayer/libs folder.

I've successfully built ijkplayer libraries under VirtualBox Ubuntu 12.04. And you'll have to install Android NDK.

Pavel S.
  • 302
  • 1
  • 2
  • 10
  • Thanks man, yeah i got it. I'm on windows, by using of cygwin, I've try to create libraries... but new issue appear, When I try `$ ./compile-ffmpeg.sh all` it show me "You must define ANDROID_NDK, ANDROID_SDK before starting. They must point to your NDK and SDK directories.\n" How can solve this issue? Should I create path in environment variables? – MAY3AM Jul 07 '14 at 08:04
  • 1
    Actually I'm not sure whether you will be able to compile these libs on Cygwin - at least I haven't seen any info about successfull ffmpeg for Android build using Cygwin. If you want to use Cygwin, you have to create environmental variables for ANDROID_NDK and ANDROID_SDK - but as I remember it didn't work for me. My advice is to use Linux - you'll get rid of a lot of problems with compiling now and in future. – Pavel S. Jul 07 '14 at 08:51
  • **+1** for recommendation to use Linux instead of struggling with Cygwin. But for the members of **WM** (Windows mazo) community, here is the guide: _[How to compile ffmpeg-2.2.2 on windows with cygwin and android ndk r9c](http://stackoverflow.com/questions/23683518/how-to-compile-ffmpeg-2-2-2-on-windows-with-cygwin-and-android-ndk-r9c)_ – Alex Cohn Sep 28 '14 at 18:15
  • I'm on Mac (no cygwin, cygwin is not compatible), i have run "compile-ffmpeg.sh" and "compile-ijk.sh" ,everything went well. In Android Studio when i run Gradle (Sync Project with Gradle Files), everything is ok. But i have exactly same error when i start my application on device. Can you help me ? – fingerup Jan 07 '15 at 11:00
  • @fingerup , which device do you use? And which version of ijkplayer? Probably there are no suitable libs for your processor type or there are some mistakes in storing libs in project. – Pavel S. Jan 08 '15 at 10:58
  • @pavel-s : I use Nexus 5 on android 4.4.2. I use last version of ijkplayer (I don't find number version). I think ijkplayer not compatible with AndroidStudio, bbcallen of ijkplayer's github answer me : https://github.com/bbcallen/ijkplayer/issues/150#issuecomment-69124115 – fingerup Jan 08 '15 at 12:57
  • 1
    @fingerup, no, it should _definitely_ work if you have prebuilt libs and then put them to right folder. Probably you need to make some additional tweaking, but I'm not familiar much with Android Studio. – Pavel S. Jan 10 '15 at 12:13