bilibili / ijkplayer

Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.
GNU General Public License v2.0
32.6k stars 8.14k forks source link

android运行demo报错:couldn't find "libijkffmpeg.so" #2513

Closed paul8228351 closed 7 years ago

paul8228351 commented 7 years ago

如题,在android studio中直接导入demo,运行会报错couldn't find "libijkffmpeg.so",具体日志如下: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/tv.danmaku.ijk.media.example-2/base.apk"],nativeLibraryDirectories=[/data/app/tv.danmaku.ijk.media.example-2/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libijkffmpeg.so" at java.lang.Runtime.loadLibrary(Runtime.java:367) at java.lang.System.loadLibrary(System.java:1076) at tv.danmaku.ijk.media.player.IjkMediaPlayer$1.loadLibrary(IjkMediaPlayer.java:163) at tv.danmaku.ijk.media.player.IjkMediaPlayer.loadLibrariesOnce(IjkMediaPlayer.java:175) at tv.danmaku.ijk.media.example.activities.VideoActivity.onCreate(VideoActivity.java:136) at android.app.Activity.performCreate(Activity.java:6877) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3207) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350) at android.app.ActivityThread.access$1100(ActivityThread.java:223) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7224) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

RMTT commented 7 years ago

多放几个平台的so库

paul8228351 commented 7 years ago

我这里面确实没有so库,哪里有已经编好的so库

peterhuang007 commented 7 years ago

@paul8228351 git clone https://github.com/Bilibili/ijkplayer.git ijkplayer-android cd ijkplayer-android git checkout -B latest k0.7.5

./init-android.sh

cd android/contrib ./compile-ffmpeg.sh clean ./compile-ffmpeg.sh all cd .. ./compile-ijk.sh all (这里就是生成 so库的地方)

Yee1014 commented 7 years ago

我用Git Shell 完成执行了 git clone https://github.com/Bilibili/ijkplayer.git ijkplayer-android cd ijkplayer-android git checkout -B latest k0.7.5

但是执行./init-android.sh出错 !

无法将“init-android.sh”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请 检查名称的拼写,如果包括路径,请确保路径正确,然后重试。 所在位置 行:1 字符: 16

应该怎么操作?能否有谁可以教一下。

@peterhuang007

wheatdamon commented 7 years ago

求问如何解决的?

963375877 commented 7 years ago

程序运行在安卓手机上时出现 抱歉XXX程序已退出,生成log日志,日志内容如下。 java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/tv.danmaku.ijk.media.example-1/base.apk", zip file "/data/app/tv.danmaku.ijk.media.example-1/split_lib_dependencies_apk.apk", zip file "/data/app/tv.danmaku.ijk.media.example-1/split_lib_slice_0_apk.apk", zip file "/data/app/tv.danmaku.ijk.media.example-1/split_lib_slice_1_apk.apk", zip file "/data/app/tv.danmaku.ijk.media.example-1/split_lib_slice_2_apk.apk", zip file "/data/app/tv.danmaku.ijk.media.example-1/split_lib_slice_3_apk.apk", zip file "/data/app/tv.danmaku.ijk.media.example-1/split_lib_slice_4_apk.apk", zip file "/data/app/tv.danmaku.ijk.media.example-1/split_lib_slice_5_apk.apk", zip file "/data/app/tv.danmaku.ijk.media.example-1/split_lib_slice_6_apk.apk", zip file "/data/app/tv.danmaku.ijk.media.example-1/split_lib_slice_7_apk.apk", zip file "/data/app/tv.danmaku.ijk.media.example-1/split_lib_slice_8_apk.apk", zip file "/data/app/tv.danmaku.ijk.media.example-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/tv.danmaku.ijk.media.example-1/lib/arm, /vendor/lib, /system/lib]]] couldn't find " libijkffmpeg.so" at java.lang.Runtime.loadLibrary(Runtime.java:367) at java.lang.System.loadLibrary(System.java:1076) at tv.danmaku.ijk.media.player.IjkMediaPlayer$1.loadLibrary(IjkMediaPlayer.java:176) at tv.danmaku.ijk.media.player.IjkMediaPlayer.loadLibrariesOnce(IjkMediaPlayer.java:187) at tv.danmaku.ijk.media.example.activities.VideoActivity.onCreate(VideoActivity.java:137) at android.app.Activity.performCreate(Activity.java:6303) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2402) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2509) at android.app.ActivityThread.access$1000(ActivityThread.java:153) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:5524) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:740) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:630)

原因couldn't find "libijkffmpeg.so" , 解决方法是进入原来的ijkplayer目录下,找到compile-ijk.sh 这个文件所在目录,我的是 /home/tbs/ijkplayer-master/android ,然后输入./ compile-ijk.sh执行它,会自动编译生成很多so文件,不用管,这时候重新打开android studio导入项目,运行问题解决。

fukemy commented 6 years ago

i got this message when build complie-ffmpeg

contrib thehe$ ./compile-ffmpeg.sh all 
====================
[*] check archs
====================
FF_ALL_ARCHS = armv5 armv7a arm64 x86 x86_64
FF_ACT_ARCHS = armv5 armv7a arm64 x86 x86_64

====================
[*] check env armv5
====================
FF_ARCH=armv5
FF_BUILD_OPT=

--------------------
[*] make NDK standalone toolchain
--------------------
build on Darwin x86_64
ANDROID_NDK=/Users/thehe/Library/Android/sdk/ndk-bundle
IJK_NDK_REL=17.1.4828580
NDKr17.1.4828580 detected
HOST_OS=darwin
HOST_EXE=
HOST_ARCH=x86_64
HOST_TAG=darwin-x86_64
HOST_NUM_CPUS=8
BUILD_NUM_CPUS=16
Auto-config: --arch=arm
ERROR: Failed to create toolchain.