在2015的Google I / O大会,5月底,谷歌宣布了一项新的支持由Android NDK Studio 1.3,Jetbrains CLion集成功能,Android gradle插件。这种支持只在7月已经发布,虽然很有前途,还是在沉重的发展。
新的工具包支持需要使用Android Studio 1.3 RC1 +和Android gradle-experimental插件。
distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath ‘com.android.tools.build:gradle-experimental:0.3.0-alpha5‘ } }
apply plugin: ‘com.android.application‘ android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { applicationId "com.ph0b.example" minSdkVersion 15 targetSdkVersion 23 versionCode 4 versionName "1.0.1" ndk { moduleName "mymodule" ldLibs "log" stl "gnustl_static" cFlags "-std=c++11 -fexceptions" } } signingConfigs { release { storeFile file(STORE_FILE) storePassword STORE_PASSWORD keyAlias KEY_ALIAS keyPassword KEY_PASSWORD } } buildTypes { release { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile(‘proguard-android-optimize.txt‘), ‘proguard-rules.txt‘ signingConfig signingConfigs.release } debug { jniDebuggable true } } } dependencies { compile ‘com.android.support:support-v4:23.0.1‘ compile fileTree(dir: ‘libs‘, include: [‘*.jar‘]) }
apply plugin: ‘com.android.model.application‘ model { android { compileSdkVersion = rootProject.ext.compileSdkVersion buildToolsVersion = rootProject.ext.buildToolsVersion defaultConfig.with { applicationId = "com.ph0b.example" minSdkVersion.apiLevel = 15 targetSdkVersion.apiLevel = 23 versionCode = 4 versionName = "1.0.1" } } android.ndk { moduleName = "mymodule" ldLibs += [‘log‘] cppFlags += "-std=c++11" cppFlags += "-fexceptions" stl = ‘gnustl_shared‘ } android.signingConfigs { create("release") { keyAlias = KEY_ALIAS keyPassword = STORE_PASSWORD storeFile = file(STORE_FILE) storePassword = KEY_PASSWORD } } android.buildTypes { release { minifyEnabled = true shrinkResources = true proguardFiles += file(‘proguard-rules.txt‘) // signingConfig = signingConfigs.release //not activated yet because of https://code.google.com/p/android/issues/detail?id=182249 } } } dependencies { compile ‘com.android.support:support-v4:23.0.1‘ compile fileTree(dir: ‘libs‘, include: [‘*.jar‘]) }
model { //... android.ndk { moduleName = "mymodule" } }
android.ndk { moduleName = "mymodule" ldLibs += [‘log‘] ldFlags += "" toolchain = "clang" toolchainVersion = "3.9" abiFilters += "x86" CFlags += "" cppFlags += "" debuggable = false renderscriptNdkMode = false stl = "system" platformVersion = 15 }
原文:http://www.cnblogs.com/zhuyuliang/p/5007016.html