I'm developing an android application for simple Facial recognition. My Application build and run fine in emulator but get Cmake Error when try to install in real device. Error Message:
Task :engine:configureCMakeDebug[arm64-v8a] FAILED Execution failed for task ':engine:configureCMakeDebug[arm64-v8a]'. [CXX1410] D:\KAM\code\AET\AET\engine.cxx\Debug\3p465u2i\arm64-v8a\android_gradle_build.json debug|arm64-v8a : expected buildTargetsCommandComponents or ncnn-release-arm64-v8a.buildCommandComponents to exist
CMakeList.txt:
cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_BUILD_TYPE "release")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../../../distribution/${ANDROID_ABI})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
add_library(ncnn STATIC IMPORTED)
set_target_properties(ncnn PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libncnn.a)
add_library(opencv_core STATIC IMPORTED)
set_target_properties(opencv_core PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libopencv_core.so)
add_library(opencv_imgproc STATIC IMPORTED)
set_target_properties(opencv_imgproc PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libopencv_imgproc.so)
add_library(opencv_codecs STATIC IMPORTED)
set_target_properties(opencv_codecs PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libopencv_imgcodecs.so)
file(GLOB jni_srcs
"*.cpp"
"detection/*.cpp"
"live/*.cpp"
)
add_library(engine SHARED ${jni_srcs})
target_link_libraries(engine log jnigraphics ncnn opencv_core opencv_imgproc opencv_codecs android -static-openmp -fopenmp)
build.gradle(Module: engine):
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 30
buildToolsVersion "29.0.3"
defaultConfig {
minSdkVersion 28
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
externalNativeBuild {
cmake {
cppFlags "-std=c++11 -frtti -fexceptions"
abiFilters 'arm64-v8a'
arguments "-DANDROID_ARM_NEON=TRUE"
arguments "-DANDROID_TOOLCHAIN=clang"
}
}
}
packagingOptions {
pickFirst '**/*.so'
}
externalNativeBuild {
cmake {
version = "3.6.0"
path "src/main/cpp/CMakeLists.txt"
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
ndkVersion '22.1.7171670'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.core:core-ktx:1.3.2'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
I try to find the reason but no luck. So far find only [this][1].
Any help or resource will be great for me. Thanks
first rebuild your app and then check this location
PROJECT PATH...\app\build\intermediates\cmake\debug\obj
There should be at least 4 folders for different abi's
x86 - x64 -- arm64/v7a -- arm64/v8
if its not exist there
apply this to your build.gradle
abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.