Skip to content

Instantly share code, notes, and snippets.

@ph0b
Last active November 20, 2019 09:21
Show Gist options
  • Save ph0b/0575b30b67e04f2ec10f to your computer and use it in GitHub Desktop.
Save ph0b/0575b30b67e04f2ec10f to your computer and use it in GitHub Desktop.
config example on Multiple APK support and mixing gradle-stable and gradle-experimental plugin, for NDK-enabled Android projects. To support AS 2.0 debug, just add lib/build/intermediates/binaries/release/obj/[abi] to Symbol directories
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.example.yourapp"
minSdkVersion 16
targetSdkVersion 23
versionCode 1230
versionName "1.2.3"
}
splits {
abi {
enable true
reset()
include 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
universalApk true
}
}
// map for the version code
project.ext.versionCodes = ['armeabi': 1, 'armeabi-v7a': 2, 'arm64-v8a': 3, 'mips': 5, 'mips64': 6, 'x86': 8, 'x86_64': 9]
applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 0) * 1000000 + defaultConfig.versionCode
}
}
buildTypes {
debug {
jniDebuggable true
}
}
}
dependencies {
compile project(':lib')
}
apply plugin: 'com.android.model.library'
model {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig.with {
minSdkVersion.apiLevel = 16
targetSdkVersion.apiLevel = 23
}
}
android.ndk {
moduleName = "mylib"
ldLibs.addAll(['log'])
cppFlags.add("-std=c++11")
cppFlags.add("-fexceptions")
platformVersion = 15
}
}
// 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.6.0'
classpath 'com.android.tools.build:gradle:2.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
ext {
compileSdkVersion = 23
buildToolsVersion = "23.0.2"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment