Android Studio:错误:'__ NDK_FPABI__'未命名类型

时间:2016-08-02 01:47:18

标签: android c++ opencv android-ndk

我遇到与构建Android的OpenCV人脸检测示例的链接相同的错误:

ERROR: '__NDK_FPABI__' does not name a type

ERROR: '__NDK_FPABI__' does not name a type. Version 2

我很抱歉提出同样的问题,但答案对我来说并不清楚。我知道发生错误是因为Android Studio使用的是/ usr / include中的库而不是NDK中的库。但是,我不怎么纠正。

以下是我的文件:

Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

include /home/marcos/Downloads/Eclipse_Android_OpenCV/OpenCV-android-sdk/sdk/native/jni/OpenCV.mk

#OPENCV_CAMERA_MODULES:=off
OPENCV_INSTALL_MODULES:=on
#OPENCV_LIB_TYPE:=SHARED

LOCAL_SRC_FILES  := DetectionBasedTracker_jni.cpp
LOCAL_C_INCLUDES += $(LOCAL_PATH) 
LOCAL_LDLIBS     += -llog -ldl
LOCAL_SDK_VERSION := 23
LOCAL_NDK_STL_VARIANT := gnustl_static

LOCAL_MODULE     := detection_based_tracker

include $(BUILD_SHARED_LIBRARY)

Application.mk

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi-v7a
APP_PLATFORM := android-8

build.graddle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    sourceSets.main {
        jniLibs.srcDir 'src/main/libs'
        jni.srcDirs = [] //disable automatic ndk-build call
    }

    defaultConfig {
        applicationId "org.opencv.samples.facedetect"
        minSdkVersion 8
        targetSdkVersion 23

        ndk {
            moduleName "detection_based_tracker"
        }
    }

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

    tasks.withType(JavaCompile) {
        compileTask -> compileTask.dependsOn ndkLibsToJar
    }

    task ndkLibsToJar(type: Zip, dependsOn: 'ndkBuild', description: 'Create a JAR of the native libs') {
        destinationDir new File(buildDir, 'libs')
        baseName 'ndk-libs'
        extension 'jar'
        from(new File(buildDir, 'libs')) { include '**/*.so' }
        into 'lib/'
    }

    task ndkBuild(type: Exec, description: 'Compile JNI source via NDK') {
        println('executing ndkBuild')
        commandLine "/home/marcos/Downloads/Eclipse_Android_OpenCV/android-ndk-r12b/ndk-build",
                'NDK_PROJECT_PATH=build',
                'APP_BUILD_SCRIPT=src/main/jni/Android.mk',
                'NDK_APPLICATION_MK=src/main/jni/Application.mk'
    }
}

dependencies {
    compile project(':openCVLibrary2411')
}

以下是错误:

Error:(856, 5) error: '__NDK_FPABI__' does not name a type
Error:(36, 2) error: #error Bionic header ctype.h does not define either _U nor _CTYPE_U
Error:(62, 35) error: '_CTYPE_U' was not declared in this scope
Error:(63, 32) error: '_CTYPE_L' was not declared in this scope
Error:(64, 32) error: '_CTYPE_U' was not declared in this scope
Error:(64, 37) error: '_CTYPE_L' was not declared in this scope
Error:(65, 32) error: '_CTYPE_N' was not declared in this scope
Error:(66, 33) error: '_CTYPE_X' was not declared in this scope
Error:(66, 38) error: '_CTYPE_N' was not declared in this scope
Error:(67, 32) error: '_CTYPE_S' was not declared in this scope
Error:(68, 32) error: '_CTYPE_P' was not declared in this scope
Error:(68, 37) error: '_CTYPE_U' was not declared in this scope
Error:(68, 42) error: '_CTYPE_L' was not declared in this scope
Error:(68, 47) error: '_CTYPE_N' was not declared in this scope

有人知道如何纠正吗?

任何提示都会非常有用,

感谢。

0 个答案:

没有答案