編譯JNI項目時,遇到了這樣的錯誤:
More than one file was found with OS independent path 'lib/x86_64/libopencv_java4.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
![](https://img.laitimes.com/img/9ZDMuAjOiMmIsIjOiQnIsIyZuBnLwIDNxUDMzMTM5AzNwAjMwIzLc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.png)
解決方案:
sourceSets {
main { jniLibs.srcDirs = ['libs']}
}