我正在开发一个用于简单面部识别的Android应用程序。
我的应用程序在仿真器、error-message:
CMake相关任务的Gradle错误任务:engine:figreCMakeDebugarm64-v8a任务失败执行失败:engine:figreCMakeDebugarm64-v8a‘。D:\KAM\code\AET\AET\engine.cxx\Debug\3p465u2i\arm64-v8a\android_gradle_build.json调试/arm64-v8a:预期的buildTargetsCommandComponents或ncnn版本-arm64-v8a.buildCommandComponents将存在
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(模块:引擎):
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发布于 2022-11-09 14:06:44
我刚刚遇到了类似的“预期的buildTargetsCommandComponents .”错误日志
和其他许多次一样,删除构建目录并重新启动IDE解决了这个问题。
发布于 2022-07-06 07:52:00
首先重建应用程序,然后检查这个位置。
PROJECT PATH...\app\build\intermediates\cmake\debug\obj不同的abi应该至少有4个文件夹
x86 - x64 -- arm64/v7a -- arm64/v8
如果不存在的话
将此应用于您的build.gradle
abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a'https://stackoverflow.com/questions/72879115
复制相似问题