1. 程式人生 > >Android 開發時遇到的坑

Android 開發時遇到的坑

1.建立檔案時選擇了c++時遇到這個錯誤

Error:executing external native build for cmake D:\dev\testcode\MayApplication\app\CMakeLists.txt

解決辦法:在build.gradle 里加上下面***中間這段

android {
    compileSdkVersion 25
    buildToolsVersion "28.0.0"
    defaultConfig {
        applicationId "test.a1234.com.mayapplication"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        externalNativeBuild {
            cmake {
                cppFlags ""
            }
        }
//*********
        ndk{
            moduleName "native-lib"
            abiFilters "x86","x86_64","armeabi-v7a","arm64-v8a"
        }
//*********
    }
    buildTypes {