Execution failed for task ':sdk:mergeDebugNativeLibs'
Execution failed for task ':sdk:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
2 files found with path 'lib/arm64-v8a/libaaa.so' from inputs:
- /Volumes/hp-sxf/StudioProjects/face/sdk/build/intermediates/merged_jni_libs/debug/out/arm64-v8a/libaaa..so
- /Volumes/hp-sxf/StudioProjects/face/sdk/build/intermediates/cxx/Debug/5h3r672g/obj/arm64-v8a/libaaa..so
If you are using jniLibs and CMake IMPORTED targets, see
https://developer.android.com/r/tools/jniLibs-vs-imported-targets
网上看了很多原因,也看了官方解释,跟我的情况还不一样,我的最后查到的原因是因为配置了gradle task,这个task 会在编译期拷贝libaaa.so到cmake依赖的文件夹,但是换了一个gradle版本,这个就会报错了,匪夷所思,把拷贝逻辑去掉就好了
很久之后,又遇到了同样的问题,按官方解释的把sourceSets去掉,也不行,最后试了下不去掉sourceSets,而是把里边的dir置为空可以顺利build通过,这种情况存在于创建在gradle4之前,又切换到gradle4.0之后。
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 = [] } }