blob: 50ca92a78eb0112c7211b2c1b82a34d469d85091 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
apply plugin: 'com.android.application'
import com.android.build.OutputFile;
dependencies {
api project(':lib')
testImplementation 'junit:junit:4.12'
androidTestImplementation "com.android.support.test:runner:${libs.versions.testSupportLibVersion.get()}"
androidTestImplementation "com.android.support.test:rules:${libs.versions.testSupportLibVersion.get()}"
}
// map for the version code for ABIs.
// x86 is more important because x86 devices also support arm.
// Same for mips
ext.versionCodes = ["armeabi-v7a":1, "mips":2, "x86":3, "all":0]
android {
namespace "com.example.hellojni.app"
compileSdkVersion rootProject.latestCompileSdk
buildToolsVersion = rootProject.buildToolsVersion
defaultConfig {
// This actual the app version code. Giving ourselves 100,000 values [0, 99999]
versionCode 123
minSdkVersion libs.versions.ndk19SupportLibMinSdk.get()
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
flavorDimensions 'version'
productFlavors {
gingerbread {
minSdkVersion libs.versions.ndk19SupportLibMinSdk.get()
versionCode = 1
}
icecreamSandwich {
minSdkVersion libs.versions.ndk19SupportLibMinSdk.get()
versionCode = 2
}
}
splits {
abi {
enable = true
universalApk = true
exclude "x86_64", "mips64", "arm64-v8a", "armeabi"
}
}
// make per-variant version code
applicationVariants.all { variant ->
// get the version code for the flavor
def apiVersion = variant.productFlavors.get(0).versionCode
// assign a composite version code for each output, based on the flavor above
// and the density component.
variant.outputs.all { output ->
// get the key for the abi component
def key = output.getFilter(OutputFile.ABI) == null ? "all" : output.getFilter(OutputFile.ABI)
// set the versionCode on the output.
output.versionCodeOverride = apiVersion * 1000000 + project.ext.versionCodes.get(key) * 100000 + defaultConfig.versionCode
}
}
}
|