android 动态id名称,Android动态配置ApplicationId,App名字,AppLogo

def localProperties = newProperties()

def localPropertiesFile= rootProject.file('local.properties')if(localPropertiesFile.exists()) {

localPropertiesFile.withReader('UTF-8') { reader ->localProperties.load(reader)

}

}

def flutterRoot= localProperties.getProperty('flutter.sdk')if (flutterRoot == null) {throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")

}

def flutterVersionCode= localProperties.getProperty('flutter.versionCode')if (flutterVersionCode == null) {

flutterVersionCode= '1'}

def flutterVersionName= localProperties.getProperty('flutter.versionName')if (flutterVersionName == null) {

flutterVersionName= '1.0'}//打包时间

def releaseTime() {return new Date().format("yyyyMMddHHmm")

}

apply plugin:'com.android.application'apply plugin:'kotlin-android'apply from:"$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"android {

flavorDimensions"default"signingConfigs {

debug {

storeFile file('AndroidKeyStore')

storePassword'1234567'keyAlias= 'keyforproject'keyPassword'123456'}

release {

storeFile file('AndroidKeyStore')

storePassword'1234567'keyAlias= 'keyforproject'keyPassword'123456'}

}

compileSdkVersion28sourceSets {

main.java.srcDirs+= 'src/main/kotlin'}

lintOptions {

disable'InvalidPackage'}//APP默认配置

defaultConfig {

applicationId= 'com.xiaoxiao.tengxun'signingConfig signingConfigs.debug

minSdkVersion16targetSdkVersion28versionName"1.0.1"versionCode10

//versionCode flutterVersionCode.toInteger()//versionName flutterVersionName

testInstrumentationRunner"android.support.test.runner.AndroidJUnitRunner"ndk {//选择要添加的对应 cpu 类型的 .so 库。

abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64', 'arm64-v8a'}

manifestPlaceholders=[

JPUSH_PKGNAME : applicationId,

JPUSH_APPKEY :"appkey", //NOTE: JPush 上注册的包名对应的 Appkey.

JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.

]

}//不同APP的配置

productFlavors {

jingdong {

applicationId"com.xiaoxiao.jingdong"resValue"string", "app_name", "jingdong"manifestPlaceholders= [CHANNEL_VALUE: "jingdong",app_icon :"@mipmap/ic_launcher"]

}

tengxun {

applicationId"com.xiaoxiao.tengxun"resValue"string", "app_name", "tengxun"manifestPlaceholders= [CHANNEL_VALUE: "tengxun",app_icon :"@mipmap/ic_launcher"]

}

xiaomi {

applicationId"com.xiaoxiao.xiaomi"resValue"string", "app_name", "xiaomi"manifestPlaceholders= [CHANNEL_VALUE: "xiaomi",

app_icon :"@mipmap/ic_launcher",

JPUSH_PKGNAME : applicationId,

JPUSH_APPKEY :"appkey", //NOTE: JPush 上注册的包名对应的 Appkey.

JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.

]

}

}

buildTypes {//测试版本

debug {/*签名类型*/signingConfig signingConfigs.debug/*是否开启代码混淆,默认false*/minifyEnabledfalse

/*是否应该生成可调试的apk*/debuggabletrue

/*混淆规则配置文件*/

//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

/*自定义buildType*/

//buildConfigField 'String', 'BASE_URL', '"http://api-debug.**/"'

}//生产版本

release {/*签名类型*/signingConfig signingConfigs.release/*是否开启代码混淆,默认false*/minifyEnabledfalse

/*是否应该生成可调试的apk*/debuggablefalse

/*移除无用的resource文件*/

//shrinkResources true

/*混淆规则配置文件*/

//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

/*自定义buildType*/

//buildConfigField 'String', 'BASE_URL', '"http://api-release.**/"'

}//预生产版本

/*从给定的构建类型复制所有属性*/pre.initWith(release)

pre {

buildConfigField"String", "BASE_URL", "http://api-pre.**/"matchingFallbacks= ['pre', 'debug', 'release']

}

}//当执行"Generate Signed Bundle or APK"时候,取消注释,生成apk文件名//android.applicationVariants.all { variant ->//variant.outputs.all { output ->//def outputFile = output.outputFile//if (outputFile != null && outputFile.name.endsWith('.apk')) {// //这里修改apk文件名//def fileName = "hu_${variant.productFlavors[0].name}-${defaultConfig.versionCode}-${defaultConfig.versionName}-${releaseTime()}.apk"// //def fileName = outputFile.name.replace("app", "${rootProject.ext.appName}-${releaseTime()}-${defaultConfig.versionCode}-${defaultConfig.versionName}")// //output.outputFile = new File(outputFile.parent, fileName)//outputFileName = fileName//}//}//}

}

flutter {

source'../..'}

dependencies {

implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"testImplementation'junit:junit:4.12'androidTestImplementation'com.android.support.test:runner:1.0.2'androidTestImplementation'com.android.support.test.espresso:espresso-core:3.0.2'}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值