Android java.lang.UnsatisfiedLinkError - 找不到 "libffmpeg.so"

标签 android c++ android-studio ffmpeg android-ndk

我已经用 eclipse 构建了这个项目 https://github.com/youtube/yt-watchme它运行良好,但是当我尝试在 android studio 中构建这个项目时,我的 Ffmpeg 类出现错误,我已将我在 eclipse 中制作的运行演示中的所有文件复制到我的 android studio 项目目录,我将发布我的目录结构和 build.gradle ,请有人指导我吗?请看下面

Process: com.google.android.apps.watchme, PID: 6330
    java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.google.android.apps.watchme-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libffmpeg.so"
            at java.lang.Runtime.loadLibrary(Runtime.java:366)
            at java.lang.System.loadLibrary(System.java:988)
            at com.google.android.apps.watchme.Ffmpeg.<clinit>(Ffmpeg.java:22)
            at com.google.android.apps.watchme.VideoStreamingConnection.open(VideoStreamingConnection.java:71)
            at com.google.android.apps.watchme.StreamerService.startStreaming(StreamerService.java:73)
            at com.google.android.apps.watchme.StreamerActivity.startStreaming(StreamerActivity.java:161)
            at com.google.android.apps.watchme.StreamerActivity.access$200(StreamerActivity.java:39)
            at com.google.android.apps.watchme.StreamerActivity$1.onServiceConnected(StreamerActivity.java:55)
            at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1208)
            at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1225)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5343)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)

enter image description here

在 JNI 函数中

enter image description here

最佳答案

是否为所有 abis 添加了“libffmpeg.so”文件?('x86'、'x86_64'、'armeabi'、'armeabi-v7a'、'arm64-v8a'、'mips'、'mips64') 如果没有,则仅为可用的 abis 生成 apk。 假设有 libffmpeg.so 文件用于 'armeabi'、'armeabi-v7a' abis。然后你需要在 app.gradle 的 android {} 部分的结尾添加以下内容。

splits {

    // Configures multiple APKs based on ABI.
    abi {

        // Enables building multiple APKs per ABI.
        enable true

        // By default all ABIs are included, so use reset() and include to specify that we only
        // want APKs for x86, armeabi-v7a, and mips.

        // Resets the list of ABIs that Gradle should create APKs for to none.
        reset()

        // Specifies a list of ABIs that Gradle should create APKs for.


        include 'armeabi', 'armeabi-v7a'
        // Specifies that we do not want to also generate a universal APK that includes all ABIs.
        universalApk false
    }
}

关于Android java.lang.UnsatisfiedLinkError - 找不到 "libffmpeg.so",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36424134/

相关文章:

android-studio - 如何从 Codename One 的构建服务器构建原生 Android 源代码

java - 如何从变量类型 Uri 获取绝对路径

android - 如何处理永远不会发生的检查异常(UnsupportedEncodingException)?

java - 如何在 Android 中转换日期和时间

c++ - 读取数学运算时 cin 无法正常运行

安卓错误 :Configuration with name 'default' not found

android - 在新的 Android Studio 中使用 OpenCL

android - 从 android 中的 tabactivity 调用 listactiviy

c++ - 从新分配的内存分配给对象

c++ - 如何使用 BFS 算法只保留外部点?