123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- ext.mainApp = true //设置为true,表示此module为主app module,一直以application方式编译
- apply from: rootProject.file('cc-settings.gradle')
- apply from: rootProject.file('common-build.gradle')
- android {
- compileSdkVersion rootProject.compile_sdk_version
- defaultConfig {
- applicationId rootProject.application_id
- minSdkVersion rootProject.min_sdk_version
- targetSdkVersion rootProject.target_sdk_version
- versionCode rootProject.application_version_code
- versionName rootProject.application_version_name
- ndk {
- //选择要添加的对应 cpu 类型的 .so 库。
- abiFilters 'armeabi-v7a'
- // 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
- }
- }
- signingConfigs {
- // release {
- // keyAlias "sultra"
- // keyPassword "123"
- // storeFile file("../demo.jks")
- // storePassword "Sultra@31314"
- // v2SigningEnabled true
- // }
- }
- buildTypes {
- debug {
- // signingConfig signingConfigs.release
- versionNameSuffix "-" + name
- }
- release {
- debuggable false
- minifyEnabled true
- zipAlignEnabled true
- shrinkResources true
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- signingConfig signingConfigs.release
- }
- }
- //指定release APK名称
- applicationVariants.all { variant ->
- variant.outputs.all {
- // 输出apk名称为 1.0_vivo.apk
- def fileName = "${variant.productFlavors[0].name}_${defaultConfig.versionName}.apk"
- outputFileName = fileName
- }
- }
- flavorDimensions "version"
- //指定渠道
- productFlavors {
- dev {}
- vivo {}
- oppo {}
- huawei {}
- xiaomi {}
- coolapk {}
- yingyongbao {}
- }
- // 批量渠道包值替换
- //通过脚本获取所有渠道
- //在Terminal控制台输入gradlew assembleRelease开始打包
- //包生成在build-->outputs-->apk文件夹
- productFlavors.all {
- // 遍历替换所有渠道
- flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL: name]
- }
- //
- //Terminal窗口输入
- //打包wandoujia渠道的release版本,执行如下命令
- // gradlew assembleWandoujiaRelease
- //打包wandoujia渠道的debug版本,执行如下命令
- // gradlew assembleWandoujiaDebug
- // 只打wandoujia渠道版会生成wandoujia渠道的Release和Debug版本
- // gradlew assembleWandoujia
- //打全部Release版本
- // gradlew assembleRelease
- compileOptions {
- targetCompatibility 1.8
- sourceCompatibility 1.8
- }
- kotlinOptions {
- jvmTarget = '1.8'
- }
- android.buildFeatures {
- dataBinding = true
- viewBinding = false
- }
- }
- dependencies {
- implementation 'androidx.browser:browser:1.2.0'
- implementation 'com.github.promeg:tinypinyin-lexicons-android-cncity:2.0.3'
- implementation 'com.google.android.material:material:1.2.1'
- // implementation(name: 'open_ad_sdk', ext: 'aar')
- implementation files('libs/open_ad_sdk.aar')
- implementation project(':base')
- addComponent 'alipay'
- addComponent 'update'
- addComponent 'umeng'
- }
|