gpt4 book ai didi

opencv - 错误:ErorAndroid/sdk/ndk-bundle/ndk-build.cmd''完成,返回值非零2

转载 作者:行者123 更新时间:2023-12-02 16:44:38 26 4
gpt4 key购买 nike

我在项目中使用android Ndk,每当我要构建项目时,都会显示此错误

Error:Execution failed for task ':app:ndkBuild'. Process 'command 'E:/Android/sdk/ndk-bundle/ndk-build.cmd'' finished with non-zero exit value 2



我已经创建了android.mk和application.mk

Application.mk
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi-v7a
APP_PLATFORM := android-16

android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
C:\OpenCV-2.4.9-android-sdk
#opencv
OPENCVROOT:= C:\OpenCV-2.4.9-android-sdk
OPENCV_CAMERA_MODULES:=on
OPENCV_INSTALL_MODULES:=on
OPENCV_LLB_TYPE:=SHARED
include ${OPENCVROOT}/sdk/native/jni/OpenCV.mk


LOCAL_SRC_FILES :=com_example_abr_ndkopencvtest2_OpencvNativeClass.cpp

LOCAL_LDLIBS += -llog
LOCAL_MODULE := MyOpencvLibs

include $(BUILD_SHARED_LIBRARY)

build.gradle文件
  apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.abr.ndkopencvtest2"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

sourceSets.main{
jni.srcDirs = []
}
task ndkBuild(type: Exec,description: 'Compile JNI source via NDK'){
commandLine "E:/Android/sdk/ndk-bundle/ndk-build.cmd",
'NDK_PROJECT_PATH = build/intermediates/ndk',
'NDK_LIBS_OUT=src/main/jniLibs',
'APP_BUILD_SCRIPT=src/main/jni/Android.mk',
'NDK_APPLICATION_MK=src/main/jni/Application.mk'
}
tasks.withType(JavaCompile){
compileTask -> compileTask.dependsOn ndkBuild
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile project(':openCVLibrary249')
}

最佳答案

检查您是否添加了gradle –本地属性

android.useDeprecatedNdk = true 

然后在此之后,当您 构建项目时,您会收到 BUILD SUCCESSFUL 消息。
有关详细的流程,请确保您正确执行了成功设置Android的步骤
NDK构建环境。

关于opencv - 错误:ErorAndroid/sdk/ndk-bundle/ndk-build.cmd''完成,返回值非零2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42984111/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com