美团多渠道打包

编程入门 行业动态 更新时间:2024-10-19 07:28:47

美团<a href=https://www.elefans.com/category/jswz/34/1768561.html style=多渠道打包"/>

美团多渠道打包

1.修改项目根目录下build.gradle文件
在buildscript下的dependencies中增加:

classpath 'com.meituan.android.walle:plugin:1.1.6'

2. 修改app工程的build.gradle文件,增加如下信息:

  • 1)头部增加:
apply plugin: 'walle'
  • 2)确保有签名配置,下面是样例,
signingConfigs {release {storeFile file("../xx.jks")        // 打包的文件的地址storePassword "123456"keyAlias "xx"keyPassword "123456"}debug {storeFile file("../xx.jks")storePassword "123456"keyAlias "xx"keyPassword "123456"}}buildTypes {release {minifyEnabled trueproguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'signingConfig signingConfigs.release}debug {minifyEnabled falseproguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'signingConfig signingConfigs.debug}}
  • 3)增加如下配置:
walle {// 指定渠道包的输出路径apkOutputFolder = new File("${project.buildDir}/outputs/channels");// 定制渠道包的APK的文件名称apkFileNameFormat = '${appName}-${packageName}-${channel}-${buildType}-v${versionName}-${versionCode}-${buildTime}.apk';// 渠道配置文件channelFile = new File("${project.getProjectDir()}/channel")
}
  • 4)app的在dependencies中增加:
implementation 'com.meituan.android.walle:library:1.1.6'

3. 在app工程下新建文件channel,放置渠道信息(根据实际需要修改):

xiaomi
360
huawei
vivo

4. 获取渠道样例:

String channel = WalleChannelReader.getChannel(this.getApplicationContext());

5. 对于要设置到友盟里去,则需要参考友盟的设置方法。
6. 打包命令(更多命令及用法参考附录官方指导):

 mac:./gradlew clean assembleReleaseChannelswindows:gradlew clean assembleReleaseChannels

7. build.gradle 总的配置文件,供参考:

apply plugin: 'com.android.application'apply plugin: 'walle'

android {
compileSdkVersion 28

defaultConfig {applicationId "com.example.administrator.dabao"minSdkVersion 19targetSdkVersion 28versionCode 1
        versionName "1.0"testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"}buildTypes {release {shrinkResources trueminifyEnabled truesigningConfig signingConfigs.create("release")proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'}}signingConfigs {release {v2SigningEnabled truestoreFile file("F:\\Android_studio\\keystore\\android.keystore")storePassword "123456"keyAlias "key0"keyPassword "123456"}}}walle {// 指定渠道包的输出路径apkOutputFolder = new File("${project.buildDir}/outputs/channels");// 定制渠道包的APK的文件名称apkFileNameFormat = '${appName}-${packageName}-${channel}-${buildType}-v${versionName}-${versionCode}-${buildTime}.apk';// 渠道配置文件channelFile = new File("${project.getProjectDir()}/channel")
}dependencies {implementation fileTree(dir: 'libs', include: ['*.jar'])implementation 'com.android.support:appcompat-v7:28.0.0'implementation 'com.android.support.constraint:constraint-layout:1.1.3'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'debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.3'releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.3'implementation 'com.meituan.android.walle:library:1.1.6'}

更多推荐

美团多渠道打包

本文发布于:2024-03-07 03:04:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1716669.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多渠道

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!