对于ABI,Android ndkBuild android_gradle_build缺失

时间:2017-12-03 18:17:08

标签: android ionic-framework gradle abi ndk-build

我有一个Ionic android项目,我正在接收

  

platforms / android / .externalNativeBuild / ndkBuild / debug / armeabi-v7a / android_gradle_build.json(没有这样的文件或目录)

当我跑步时:

ionic cordova run android --device 

该文件夹'platforms / android / .externalNativeBuild / ndkBuild / debug /'为mips,mips64,x86和x86_64生成文件

我的build.gradle如下所示:

apply plugin: 'com.android.application'

repositories {
  mavenCentral()
}
android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "my.app.id"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        ndk{
          abiFilters 'x86', 'x86_64', 'mips', 'mips64', 'armeabi-v7a', 'armeabi', 'arm64-v8a'
        }
    }
    externalNativeBuild {
        ndkBuild {
            path '../../plugins/my-plugin/src/android/Android.mk'
        }
    }
    buildTypes {
        release {
            ndk {
              abiFilters 'x86', 'x86_64', 'mips', 'mips64', 'armeabi-v7a', 'armeabi', 'arm64-v8a'
            }
        }
        debug {
            ndk {
              abiFilters 'x86', 'x86_64', 'mips', 'mips64', 'armeabi-v7a', 'armeabi', 'arm64-v8a'
            }
        }
    }
}
dependencies {
  compile ('org.nanohttpd:nanohttpd:2.3.1')
}

如果我不放ABiFilters,它只是为x86和mips构建。如果我对该文件未被发现抱怨

1 个答案:

答案 0 :(得分:1)

原来我需要添加一些调试标志。

debuggable true
initWith debug
jniDebuggable true
externalNativeBuild {
  ndkBuild {
      cFlags "-DDEBUG=1"
    }
}

我的build.gradle现在看起来像     申请插件:' com.android.application'

repositories {
  mavenCentral()
}
android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "my.app.id"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        ndk{
          abiFilters 'x86', 'x86_64', 'mips', 'mips64', 'armeabi-v7a', 'armeabi', 'arm64-v8a'
        }
    }
    externalNativeBuild {
        ndkBuild {
            path '../../plugins/my-plugin/src/android/Android.mk'
        }
    }
    buildTypes {
        release {
            ndk {
              abiFilters 'x86', 'x86_64', 'mips', 'mips64', 'armeabi-v7a', 'armeabi', 'arm64-v8a'
            }
        }
        debug {
            debuggable true
            initWith debug
            jniDebuggable true
            externalNativeBuild {
              ndkBuild {
                  cFlags "-DDEBUG=1"
                }
            }
            ndk {
              abiFilters 'x86', 'x86_64', 'mips', 'mips64', 'armeabi-v7a', 'armeabi', 'arm64-v8a'
            }
        }
    }
}
dependencies {
  compile ('org.nanohttpd:nanohttpd:2.3.1')
}