在 android studio 上使用 Oboe 时出现未知警告选项“-Wshadow-field”错误

unknown warning option '-Wshadow-field' error using Oboe on android studio

我使用 android studio 创建了一个 ndk 项目,一切顺利,我可以毫无问题地在模拟器上启动我的应用程序。但是当我将 Oboe 库添加到我的项目时,当我尝试启动或构建我的应用程序时会出现此错误。 我正在为这个应用程序使用 c++14。 我认为 clang 有一些问题,但我不知道如何解决它。

这是错误日志、Cmake 文件和 build.gradle 文件:

错误日志:

Information:Gradle tasks [:app:assembleDebug]
Error:unknown warning option '-Wshadow-field' [-Werror,-Wunknown-warning-option]
Error:unknown warning option '-Wshadow-field' [-Werror,-Wunknown-warn
Error:unknown warning option '-Wshadow-field' [-Werror,-Wunknown-warning-option]
Information:BUILD FAILED in 1s
Information:3 errors
Information:0 warnings
Information:See complete output in console

CMakeLists.txt:

cmake_minimum_required(VERSION 3.4.1)
add_library( 
             native-lib
             SHARED
             src/main/cpp/native-lib.cpp )

find_library( 
              log-lib

              log )

target_link_libraries(
                       native-lib

                       ${log-lib} )

#set the path to the oboe directory
set (OBOE_DIR /home/user/AndroidProjects/oboe)

#add the Oboe library as a subdirectory in project
add_subdirectory (${OBOE_DIR} ./oboe)

#Specify the path to the Oboe header files
include_directories (${OBOE_DIR}/include)

#Specify the libraries which are native library is dependent on, including Oboe
target_link_libraries (native-lib log oboe)

build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.app.audiovisualizera"
        minSdkVersion 17
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        externalNativeBuild {
            cmake {
                cppFlags "-std=c++14"
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    externalNativeBuild {
        cmake {
            path "CMakeLists.txt"
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

谢谢

谢谢@Michael。问题来自 NDK 版本。但如果有人遇到此问题,请确保拥有最新的 andriod studio 版本和最新的 gradle 版本。因为它需要。