【发布时间】:2020-10-15 12:09:51
【问题描述】:
我遇到了错误
More than one file was found with OS independent path 'lib/x86_64/libopencv_java3.so'. If you are using jniLibs and CMake IMPORTED targets, see https://developer.android.com/studio/preview/features#automatic_packaging_of_prebuilt_dependencies_used_by_cmake
该链接将我带到一个带有 android 4.2 发行说明的页面,因此没有任何问题可以解决我的问题,
我正在使用带有 opencv 并使用 jnilibs 的 Documentscanner 库 buitl,而我遇到的问题是那个 jnilibs
所以
我浏览了 Android 开发指南并遇到了这个
Automatic packaging of prebuilt dependencies used by CMake
Prior versions of the Android Gradle Plugin required that you explicitly package any prebuilt libraries used by your CMake external native build by using jniLibs. You may have libraries in the src/main/jniLibs directory of your module, or possibly in some other directory configured in your build.gradle file:
sourceSets {
main {
// The libs directory contains prebuilt libraries that are used by the
// app's library defined in CMakeLists.txt via an IMPORTED target.
jniLibs.srcDirs = ['libs']
}
}
With Android Gradle Plugin 4.0, the above configuration is no longer necessary and will result in a build failure:
* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> More than one file was found with OS independent path 'lib/x86/libprebuilt.so'
External native build now automatically packages those libraries, so explicitly packaging the library with jniLibs results in a duplicate. To avoid the build error, move the prebuilt library to a location outside jniLibs or remove the jniLibs configuration from your build.gradle file.
所以现在按照上面的 IE 移动库/从我的 gradle.build 等中删除。 该应用程序构建并开始安装,但随后出现错误
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_MISSING_SHARED_LIBRARY
我们将不胜感激
【问题讨论】:
-
您能否向我们展示完整的 build.gradle 文件并解释您是如何包含和/或构建该库的?如果您下载了东西,还链接到您下载的内容。如果可用,还向我们展示 CMakeLists.txt
-
与 build.gradle 一起显示
find输出或项目的目录结构 -
你可能会觉得这个话题很有趣:stackoverflow.com/questions/62088079/…