简体   繁体   English

如何为.SO文件设置相对路径?

[英]How do I set a relative path for an .SO file?

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"; 06-29 16:52:37.729 24144-24144 / com.my.app E / AndroidRuntime:致命异常:主进程:com.my.app,PID:24144 java.lang.UnsatisfiedLinkError:dlopen失败:无法加载库“ “ libFFmpegWrapper.so”所需的build / obj / local / armeabi / libavformat.so”; caused by library "build/obj/local/armeabi/libavformat.so" not found 找不到由库“ build / obj / local / armeabi / libavformat.so”引起的

build/obj/local/armeabi/libavformat.so looks wrong to me. build / obj / local / armeabi / libavformat.so在我看来错了。 The code worked with an earlier build of ffmpeg - so I suspect it's something to do with the way I build ffmpeg. 该代码与ffmpeg的早期版本一起使用-因此,我怀疑这与我构建ffmpeg的方式有关。

The libavformat.so file is in the APK where I'd expect it to be. 我想在libavformat.so文件中找到APK。

This is my build script for ffmpeg: 这是我的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");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何设置按钮的相对position? - How do I set the relative position of a button? 如何在Eclipse中设置Java路径以便在外部驱动器上运行它? - How do I set the Java path in Eclipse so I can run it on an external drive? 如何在Java文件中指定相对文件路径,以便在将文件放入jar文件后它仍然可以工作? - How to specify relative file path in Java file so that it can still work after the file is put in jar file? 如何使用 IntelliJ 中的相对路径从外部库中引用 jar 文件? - How do I reference a jar file from an External Library using relative path in IntelliJ? 如何在运行时而不是编译时从相对路径引用文件 - How do I reference a file from a relative path at runtime, not compile time 如何从可能表示绝对路径或相对路径的字符串创建文件? - How do I create a File from a string that may represent an absolute or a relative path? 如何在Websphere中为log4j.properties文件设置相对路径 - How to set relative path for log4j.properties file in Websphere FileSystemResource:如何设置相对路径 - FileSystemResource: how to set relative path 如何设置图像的相对路径? - How to set a relative path for images? 如何设置文件目录,使其在没有完整文件路径的情况下也可以工作? - How to set the file directory so that it will work without the full file path?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM