Android多渠道打包的几种常用工具( 二 )

classpath 'com.mcxiaoke.packer-ng:plugin:2.0.1'
}
}
(2)配置App build.gradle
apply plugin: 'packer'
dependencies {
......
implementation 'com.mcxiaoke.packer-ng:helper:2.0.1'
}
(3)插件配置
build {
......
packer {
archiveNameFormat = '${buildType}-v${versionName}-${channel}' // 定义输出APK名称
archiveOutput = new File(project.rootProject.buildDir, "apks") // 设置APK输出目录
channelFile = new File(project.rootDir, "channel.txt") // 添加渠道配置文件
}
}
(4)新建渠道配置文件channel.txt
在工程根目录下新建channel.txt文件,如图
Android多渠道打包的几种常用工具

文章插图
文件内容为渠道名称,要求:必须每一行一个渠道
(5)编译打包
使用Terminal命令:
gradlew clean apkRelease
Android多渠道打包的几种常用工具

文章插图

【Android多渠道打包的几种常用工具】


推荐阅读