This is my error:
06-29 16:52:37.729 24144-24144/com.my.app E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.my.app, PID: 24144 java.lang.UnsatisfiedLinkError: dlopen failed: could not load library "build/obj/local/armeabi/libavformat.so" needed by "libFFmpegWrapper.so"; caused by library "build/obj/local/armeabi/libavformat.so" not found
build/obj/local/armeabi/libavformat.so looks wrong to me. The code worked with an earlier build of ffmpeg - so I suspect it's something to do with the way I build ffmpeg.
The libavformat.so file is in the APK where I'd expect it to be.
This is my build script for ffmpeg:
#!/bin/bash
NDK=/Users/eran/Downloads/android-ndk-r10e
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64
PLATFORM=$NDK/platforms/android-12/arch-arm
PREFIX=/usr/local
function build_one
{
./configure --target-os=android --prefix=$PREFIX \
--pkg-config=./fake-pkg-config \
--enable-cross-compile \
--cpu=armv7-a \
--enable-shared \
--disable-static \
--disable-asm \
--arch=arm \
--cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
--disable-stripping \
--nm=$PREBUILT/bin/arm-linux-androideabi-nm \
--sysroot=$PLATFORM \
--disable-nonfree \
--disable-version3 \
--disable-everything \
--enable-gpl \
--disable-doc \
--enable-avresample \
--disable-demuxer=rtsp \
--disable-muxer=rtsp \
--disable-ffplay \
--disable-ffserver \
--enable-ffmpeg \
--disable-ffprobe \
--enable-libx264 \
--enable-encoder=libx264 \
--enable-decoder=h264 \
--disable-protocol=rtp \
--enable-hwaccels \
--enable-zlib \
--disable-devices \
--disable-avdevice \
--extra-cflags="-I/usr/local/include -fPIC -DANDROID -Wno-deprecated -mfloat-abi=softfp -mfpu=neon -march=armv7-a" \
--extra-ldflags="-L/usr/local/lib -Wl,--fix-cortex-a8" \
--extra-cxxflags='-Wno-multichar -fno-exceptions -fno-rtti'
make -j4 install
}
build_one
Solved by loading all required libraries rather than letting the system try and find them itself.
System.loadLibrary("x264");
System.loadLibrary("avutil");
System.loadLibrary("avcodec");
System.loadLibrary("avformat");
System.loadLibrary("swresample");
System.loadLibrary("swscale");
System.loadLibrary("FFmpegWrapper");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.