我打算使用ijkplayer github link。我下载了这个,然后通过File>将它导入eclipse;导入>一般>现有项目到工作区。之后我有三个项目:
1.ijkmediaplayer ( library )
2.ijkmediawidget ( VideoView-like interface )
3.ijkmediademo ( Demo project )
当我运行ijkmediademo时,错误发生并且程序崩溃了。我收到了这些错误:
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)
似乎程序找不到在IjkMediaPlayer类中设置的一些库:
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;
}
}
}
这些库是什么?
这些图书馆在哪里? (我在项目中找不到它们)
如何解决这个问题?
答案 0 :(得分:2)
似乎您还没有构建所需的库 - 您必须自己完成。 按照页面ijkplayer github link
上标题构建Android 下的说明操作成功构建过程后,您将获得几个库文件( libijkffmpeg,libijkutil,libijkadk,libijksdl,libijkplayer ),这些文件将自动放入ijkmediaplayer/libs
文件夹。
我已经在 VirtualBox Ubuntu 12.04 下成功构建了 ijkplayer 库。 而且你必须安装 Android NDK 。