INSTALL_FAILED_MISSING_SHARED_LIBRARY 앱이 설치되지 않도록합니다.
오류가 발생했습니다.
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
도움을 주시면 감사하겠습니다
답변
이 대답을 따르십시오 .
에 따르면 https://developer.android.com/studio/projects/gradle-external-native-builds#jniLibs
Android Gradle Plugin 4.0을 사용하는 경우이 오류를 방지하려면 IMPORTED CMake 대상에서 사용하는 라이브러리를 jniLibs 디렉토리 밖으로 이동하십시오.
따라서 $ {ANDROID_ABI} /libdlib.so 폴더를 새 디렉토리 이름 cmakeLibs 생성과 같은 다른 위치로 이동하기 만하면됩니다.
예 :
set_target_properties( dlib PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../cmakeLibs/${ANDROID_ABI}/libdlib.so )
참조- https://developer.android.com/studio/projects/gradle-external-native-builds#jniLibs
최신 opencv 모듈을 수동으로 가져 와서이 문제를 해결했습니다. 문제는 제가 사용하던 라이브러리에 포함 된 opencv가 구식이라는 것입니다.
같은 오류가 발생하면 (또는 opencv에 문제가 있으면 이것을 권장합니다)
이것이 내가 고친 방법입니다.
오류 (Opencv 등)와 관련된 모든 라이브러리와 모듈을 제거했습니다.
그런 다음 openCV Android 모듈을 다운로드하고 가져옵니다.
그런 다음 openCV를 사용하는 라이브러리를 가져옵니다 (제 경우에는 github에서 jhansireddy의 AndroidScannerDemo였습니다)
마지막으로 사용중인 라이브러리를 사용하도록 코드를 조정합니다.