Java 安装\失败\缺少\共享\库导致应用程序无法安装

Java 安装\失败\缺少\共享\库导致应用程序无法安装,java,android,cmake,Java,Android,Cmake,我发现了错误 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_

我发现了错误

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
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_MISSING_SHARED_LIBRARY
这个链接把我带到一个页面,上面有安卓4.2的发行说明,所以我的问题没有任何解释

我正在使用opencv构建的Documentscanner库,它使用jnilibs,我遇到的问题是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.
因此,在完成上述操作(移动库/从我的gradle.build中删除等)后,现在。 应用程序生成并开始安装,但随后我发现错误

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
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_MISSING_SHARED_LIBRARY
非常感谢您的帮助

请跟随

如果您使用的是Android Gradle插件4.0,请移动任何 从jniLibs目录中导入的CMake目标使用 避免这个错误

因此,只需将${ANDROID_ABI}/libdlib.So文件夹移动到 另一个地方,比如创建一个新的目录名cmakeLibs

例如:


请参阅-

我通过手动导入最新的opencv模块解决了这个问题,问题是我使用的库中包含的opencv已经过时

如果您遇到相同的错误(或者如果您对opencv有问题,我建议您这样做)

我就是这样修好的

已删除与错误相关的所有库和模块(Opencv等)

然后下载openCV android模块并导入它

然后导入使用openCV的库(在我的例子中是 jhansireddy在github上发布的AndroidScannerDemo)


然后最后调整代码以使用您正在使用的库

能否向我们展示完整的build.gradle文件并解释您是如何包含和/或构建库的?如果你下载了东西,还可以链接到你下载的东西。如果build.gradle show
find
output或项目的目录结构可用,请向我们展示CMakeLists.txt。您可能会发现这个线程很有趣:谢谢您的帮助,但解决方案非常简单,忘记了更新问题,我只需导入最新的opencv模块,就可以修复错误