gpt4 book ai didi

java - INSTALL_FAILED_MISSING_SHARED_LIBRARY 导致应用无法安装

转载 作者:行者123 更新时间:2023-12-05 00:04:16 25 4
gpt4 key购买 nike

我遇到了错误

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 的 Documentscanner 库 buitl,它使用 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.

所以现在在按照上面的 IE 移动库/从我的 gradle.build 等中删除之后。该应用程序构建并开始安装,但随后出现错误

Installation did not succeed.
The application could not be installed: INSTALL_FAILED_MISSING_SHARED_LIBRARY

帮助将不胜感激

最佳答案

请关注this answer .

According tohttps://developer.android.com/studio/projects/gradle-external-native-builds#jniLibs

If you are using Android Gradle Plugin 4.0, move any libraries thatare used by IMPORTED CMake targets out of your jniLibs directory toavoid this error.

So you only need to move the ${ANDROID_ABI}/libdlib.so folder toanother place such as creating a new directory name cmakeLibs

eg:

set_target_properties( dlib
PROPERTIES IMPORTED_LOCATION
${CMAKE_SOURCE_DIR}/../cmakeLibs/${ANDROID_ABI}/libdlib.so )

enter image description here

引用 - https://developer.android.com/studio/projects/gradle-external-native-builds#jniLibs

关于java - INSTALL_FAILED_MISSING_SHARED_LIBRARY 导致应用无法安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64371288/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com