1
2
3
4
5
6
7
8
|
android { ?? defaultConfig {
?? manifestPlaceholders = [
???????? //高德地图key
???????? GDKEY: "123456789",
???? ]
??? }
} |
1
2
3
4
|
<!-- 高德地图 --> ???? < meta-data
?????? android:name = "com.amap.api.v2.apikey"
?????? android:value = "${GDKEY}" />
|
1
2
3
4
5
6
|
android { ?? defaultConfig {
???? //在string.xml中不能出现app_name这个字段,否则生成报错
???? resValue "string", "app_name", "app名称"??
??? }
} |
1
2
3
4
5
6
7
8
|
android { ?? defaultConfig {
?????? //生成一个boolea类型的变量
?????? buildConfigField "boolean", "IS_TEST_URL", "true"
?????? //生成一个字符串变量
?????? buildConfigField "String", "APP_UPDATE_TIME", "\"${System.currentTimeMillis().toString()}\""
??? }
} |
1
2
3
4
5
|
public final class BuildConfig {
? // Fields from product flavor: 渠道名
? public static final String APP_UPDATE_TIME = "1551754973086" ;
? public static final boolean IS_TEST_URL = false ;
} |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
android { ?? compileSdkVersion 28
?? defaultConfig {
???? minSdkVersion 19
???? targetSdkVersion 28
???? testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
???? flavorDimensions "versionCode"
? ??? productFlavors {
???? name1 {
?????? applicationId "com.test.name"
?????? versionName "0.1.4"
?????? versionCode 5
?????? resValue "string", "app_name", "app名字"??
?????? buildConfigField "boolean", "IS_TEST_URL", "false"
?????? buildConfigField "String", "APP_UPDATE_TIME", "\"${System.currentTimeMillis().toString()}\""
???? }?
?? }
|
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
|
android{ ? signingConfigs {
???? release {
?????? keyAlias ''
?????? keyPassword ''
?????? storeFile file('./sign.jks')
?????? storePassword ''
?????? v2SigningEnabled false
???? }
?? }
?? buildTypes {
???? release {
?????? debuggable false
?????? minifyEnabled true
?????? shrinkResources true
?????? useProguard true
?????? proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
?????? signingConfig signingConfigs.release
???? }
???? debug {
?????? debuggable true
?????? minifyEnabled false
?????? shrinkResources false
?????? useProguard false
?????? proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
?????? signingConfig signingConfigs.release
???? }
?? }
} |
1
2
3
4
5
6
7
8
9
|
android{ ? android.applicationVariants.all { variant ->
???? variant.outputs.all {
?????? Date nowTime = new Date()
?????? SimpleDateFormat time = new SimpleDateFormat("MM月dd日HH时mm分")
?????? outputFileName = "${variant.flavorName}(${variant.versionCode}_${variant.versionName})(${time.format(nowTime)}).apk"
???? }
?? }
} |
1
2
3
4
|
configurations { ?? compile.exclude module: 'commons'
?? all*.exclude group: 'org.gradle.test.excludes', module: 'reports'
} |
1
2
3
4
5
|
dependencies { ?? implementation("com.github.bumptech.glide:glide:4.8.0") {
???? exclude module: 'appcompat-v7'
?? }
} |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
ext { ?? compileSdkVersion = 25
?? buildToolsVersion = "25.0.0"
?? minSdkVersion = 19
?? targetSdkVersion = 19
? ??? supportVersion = '25.3.1'
?? rxjavaVersion = '1.1.8'
?? rxandroidVersion = '1.2.1'
?? glideVersion = '3.6.1'
?? junitVersion = '4.12'
? ??? deps = [
?????? appcompatv7? : "com.android.support:appcompat-v7:$supportVersion",
?????? supportv4?? : "com.android.support:support-v4:$supportVersion",
?????? recyclerviewv7: "com.android.support:recyclerview-v7:$supportVersion",
?????? rxjava??? : "io.reactivex:rxjava:$rxjavaVersion",
?????? rxandroid?? : "io.reactivex:rxandroid:$rxandroidVersion",
?????? glide???? : "com.github.bumptech.glide:glide:$glideVersion",
?????? junit???? : "junit:junit:$junitVersion"
?? ]
} |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
android { ?? compileSdkVersion rootProject.compileSdkVersion
?? buildToolsVersion rootProject.buildToolsVersion
?? defaultConfig {
???? applicationId "com.ecarx.thememanager"
???? minSdkVersion rootProject.minSdkVersion
???? targetSdkVersion rootProject.targetSdkVersion
???? versionCode 1
???? versionName "1.0"
?? }
?? ...
} ? ?dependencies { ?? compile fileTree(include: ['*.jar'], dir: 'libs')
?? compile deps.supportv4
?? compile deps.appcompatv7
?? compile deps.recyclerviewv7
?? compile deps.rxjava
?? compile deps.rxandroid
?? compile deps.glide
? ??? testCompile deps.junit
} |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
android { ?? ...
?? sourceSets {
???? main {
?????? res.srcDirs =
?????????? [
?????????????? 'src/main/res',
?????????????? 'src/main/res/layouts',
?????????????? 'src/main/res/layouts/home',
?????????????? 'src/main/res/layouts/hot_sale',
?????????????? 'src/main/res/layouts/amuse',
?????????????? 'src/main/res/layouts/delicacy',
?????????????? 'src/main/res/layouts/food_management',
?????????????? 'src/main/res/layouts/settings',
?????????? ]
???? }
?? }
} |