I got the following errors:
C:\Users\amd\Documents\OpenNative\app\src\main\cpp\CMakeLists.txt : C/C++ debug|armeabi-v7a : CMake Error at C:\Users\amd\Documents\OpenNative\app\src\main\cpp\CMakeLists.txt:11 (find_package):
Found package configuration file:C:/opencv-4.5.2-android-sdk/OpenCV-android-sdk/sdk/native/jni/OpenCVConfig.cmake
but it set OpenCV_FOUND to FALSE so package “OpenCV” is considered to be
NOT FOUND.
For more details, see my repo: https://github.com/pstricks-fans/nativeopencvtest/blob/master/app/src/main/cpp/CMakeLists.txt
Other configurations:
The contents of C:/opencv-4.5.2-android-sdk/OpenCV-android-sdk/sdk/native/jni/OpenCVConfig.cmake:
if(CMAKE_VERSION VERSION_LESS "2.8.3")
get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
endif()
if(NOT DEFINED OpenCV_CONFIG_SUBDIR)
set(OpenCV_CONFIG_SUBDIR "/abi-${ANDROID_NDK_ABI_NAME}")
endif()
set(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_DIR}${OpenCV_CONFIG_SUBDIR}")
if(EXISTS "${OpenCV_CONFIG_PATH}/OpenCVConfig.cmake")
include("${OpenCV_CONFIG_PATH}/OpenCVConfig.cmake")
else()
if(NOT OpenCV_FIND_QUIETLY)
message(WARNING "Found OpenCV Android Pack but it has no binaries compatible with your ABI (can't find: ${OpenCV_CONFIG_SUBDIR})")
endif()
set(OpenCV_FOUND FALSE)
endif()
If I comment the second line from the bottom:
endif()
# set(OpenCV_FOUND FALSE)
endif()
The build is successful with the following messages:
Executing tasks: [:app:assembleDebug] in project C:\Users\amd\Documents\OpenNative
Task :app:preBuild UP-TO-DATE
Task :app:preDebugBuild UP-TO-DATE
Task :app:compileDebugAidl NO-SOURCE
Task :app:compileDebugRenderscript NO-SOURCE
Task :app:generateDebugBuildConfig UP-TO-DATE
Task :app:javaPreCompileDebug UP-TO-DATE
Task :app:checkDebugAarMetadata UP-TO-DATE
Task :app:generateDebugResValues UP-TO-DATE
Task :app:generateDebugResources UP-TO-DATE
Task :app:mergeDebugResources UP-TO-DATE
Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
Task :app:extractDeepLinksDebug UP-TO-DATE
Task :app:processDebugMainManifest UP-TO-DATE
Task :app:processDebugManifest UP-TO-DATE
Task :app:processDebugManifestForPackage UP-TO-DATE
Task :app:processDebugResources UP-TO-DATE
Task :app:compileDebugJavaWithJavac UP-TO-DATETask :app:generateJsonModelDebug
C:\Users\amd\Documents\OpenNative\app\src\main\cpp\CMakeLists.txt : C/C++ debug|armeabi-v7a : CMake Warning at C:/opencv-4.5.2-android-sdk/OpenCV-android-sdk/sdk/native/jni/OpenCVConfig.cmake:47 (message):
Found OpenCV Android Pack but it has no binaries compatible with your ABI
(can’t find: /abi-)
Call Stack (most recent call first):
CMakeLists.txt:11 (find_package)C:\Users\amd\Documents\OpenNative\app\src\main\cpp\CMakeLists.txt : C/C++ debug|armeabi-v7a : CMake Warning at C:/opencv-4.5.2-android-sdk/OpenCV-android-sdk/sdk/native/jni/OpenCVConfig.cmake:47 (message):
Found OpenCV Android Pack but it has no binaries compatible with your ABI
(can’t find: /abi-)
Call Stack (most recent call first):
CMakeLists.txt:11 (find_package)C:\Users\amd\Documents\OpenNative\app\src\main\cpp\CMakeLists.txt : C/C++ debug|arm64-v8a : CMake Warning at C:/opencv-4.5.2-android-sdk/OpenCV-android-sdk/sdk/native/jni/OpenCVConfig.cmake:47 (message):
Found OpenCV Android Pack but it has no binaries compatible with your ABI
(can’t find: /abi-)
Call Stack (most recent call first):
CMakeLists.txt:11 (find_package)C:\Users\amd\Documents\OpenNative\app\src\main\cpp\CMakeLists.txt : C/C++ debug|arm64-v8a : CMake Warning at C:/opencv-4.5.2-android-sdk/OpenCV-android-sdk/sdk/native/jni/OpenCVConfig.cmake:47 (message):
Found OpenCV Android Pack but it has no binaries compatible with your ABI
(can’t find: /abi-)
Call Stack (most recent call first):
CMakeLists.txt:11 (find_package)C:\Users\amd\Documents\OpenNative\app\src\main\cpp\CMakeLists.txt : C/C++ debug|x86 : CMake Warning at C:/opencv-4.5.2-android-sdk/OpenCV-android-sdk/sdk/native/jni/OpenCVConfig.cmake:47 (message):
Found OpenCV Android Pack but it has no binaries compatible with your ABI
(can’t find: /abi-)
Call Stack (most recent call first):
CMakeLists.txt:11 (find_package)C:\Users\amd\Documents\OpenNative\app\src\main\cpp\CMakeLists.txt : C/C++ debug|x86 : CMake Warning at C:/opencv-4.5.2-android-sdk/OpenCV-android-sdk/sdk/native/jni/OpenCVConfig.cmake:47 (message):
Found OpenCV Android Pack but it has no binaries compatible with your ABI
(can’t find: /abi-)
Call Stack (most recent call first):
CMakeLists.txt:11 (find_package)C:\Users\amd\Documents\OpenNative\app\src\main\cpp\CMakeLists.txt : C/C++ debug|x86_64 : CMake Warning at C:/opencv-4.5.2-android-sdk/OpenCV-android-sdk/sdk/native/jni/OpenCVConfig.cmake:47 (message):
Found OpenCV Android Pack but it has no binaries compatible with your ABI
(can’t find: /abi-)
Call Stack (most recent call first):
CMakeLists.txt:11 (find_package)C:\Users\amd\Documents\OpenNative\app\src\main\cpp\CMakeLists.txt : C/C++ debug|x86_64 : CMake Warning at C:/opencv-4.5.2-android-sdk/OpenCV-android-sdk/sdk/native/jni/OpenCVConfig.cmake:47 (message):
Found OpenCV Android Pack but it has no binaries compatible with your ABI
(can’t find: /abi-)
Call Stack (most recent call first):
CMakeLists.txt:11 (find_package)Task :app:externalNativeBuildDebug
Build native-lib_armeabi-v7a
ninja: Entering directoryC:\Users\amd\Documents\OpenNative\app\.cxx\cmake\debug\armeabi-v7a' ninja: no work to do. Build native-lib_arm64-v8a ninja: Entering directory
C:\Users\amd\Documents\OpenNative\app.cxx\cmake\debug\arm64-v8a’
ninja: no work to do.
Build native-lib_x86
ninja: Entering directoryC:\Users\amd\Documents\OpenNative\app\.cxx\cmake\debug\x86' ninja: no work to do. Build native-lib_x86_64 ninja: Entering directory
C:\Users\amd\Documents\OpenNative\app.cxx\cmake\debug\x86_64’
ninja: no work to do.Task :app:compileDebugSources
Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
Task :app:mergeDebugShaders UP-TO-DATE
Task :app:compileDebugShaders NO-SOURCE
Task :app:generateDebugAssets UP-TO-DATE
Task :app:mergeDebugAssets UP-TO-DATE
Task :app:compressDebugAssets UP-TO-DATE
Task :app:processDebugJavaRes NO-SOURCE
Task :app:mergeDebugJavaResource UP-TO-DATE
Task :app:checkDebugDuplicateClasses UP-TO-DATE
Task :app:dexBuilderDebug UP-TO-DATE
Task :app:desugarDebugFileDependencies UP-TO-DATE
Task :app:mergeExtDexDebug UP-TO-DATE
Task :app:mergeDexDebug UP-TO-DATE
Task :app:mergeDebugJniLibFolders UP-TO-DATE
Task :app:mergeDebugNativeLibs UP-TO-DATE
Task :app:stripDebugDebugSymbols UP-TO-DATE
Task :app:validateSigningDebug UP-TO-DATE
Task :app:packageDebug UP-TO-DATE
Task :app:assembleDebugBUILD SUCCESSFUL in 4s
28 actionable tasks: 2 executed, 26 up-to-dateBuild Analyzer results available
What is the correct way to fix this issue?