我用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)
和JNI函数
答案 0 :(得分:1)
你为所有abis添加了“libffmpeg.so”文件吗?(&#39; x86&#39;,&#39; x86_64&#39;,&#39; armeabi&#39;,&#39; armeabi- v7a&#39;,&#39; arm64-v8a&#39;,&#39; mips&#39;,&#39; mips64&#39;) 如果没有,那么只为可用的abis生成apk。 假设有一个libffmpeg.so文件,用于&#39; armeabi&#39;,&#39; armeabi-v7a&#39; 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
}
}