Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用rebuildChannel 根据已有基础包重新生成多渠道包有问题 #23

Closed
fanturbo opened this issue Dec 22, 2017 · 4 comments
Closed

Comments

@fanturbo
Copy link

fanturbo commented Dec 22, 2017

channel{
    //指定渠道文件
    channelFile = file("../channel.txt")
    //多渠道包的输出目录,默认为new File(project.buildDir,"channel")
    baseOutputDir = new File(project.buildDir,"channel")
    //多渠道包的命名规则,默认为:${appName}-${versionName}-${versionCode}-${flavorName}-${buildType}
    apkNameFormat ='${appName}-${versionName}-${versionCode}-${flavorName}-${buildType}'
}

rebuildChannel {
    //指定渠道文件
    channelFile = new File("../channel.txt")
    baseReleaseApk = new File(project.buildDir, "outputs/apk/app-release.apk")
    //默认为new File(project.buildDir, "rebuildChannel/release")
    releaseOutputDir = new File(project.buildDir, "rebuildChannel/release")
}

上面是我的配置,但是执行rebuildChannel之后只有一个渠道包(rebuildChannel\release目录下只有一个app-release.apk文件)生成,是怎么回事呢?ps:执行channel命令打渠道包是正常的

@ltlovezh
Copy link
Collaborator

这里“rebuildChannel”生成渠道包时,会用新渠道名替换已有基础包的“base”字符串,但是"outputs/apk/app-release.apk"不包含“base”字符串,所以新的渠道包名字还是app-release.apk,因此后面的APK就把前面的覆盖了,最后只出现一个。短期解决就是改下基础包的命名“app-base-release.apk”,后续我发个版本fix下这个问题

@baixxx
Copy link

baixxx commented Mar 8, 2018

请问一下,配置好之后,执行rebuildChannel并没有生成rebuildChannel目录,第一种方法没问题

@ltlovezh
Copy link
Collaborator

ltlovezh commented Mar 8, 2018

执行有错误吗

@baixxx
Copy link

baixxx commented Mar 9, 2018

我的配置如下,未报错
rebuildChannel {
//指定渠道文件
channelFile = new File("../channel.txt")
baseReleaseApk = new File(project.buildDir, "outputs/apk/app-base-release.apk")
//默认为new File(project.buildDir, "rebuildChannel/release")
releaseOutputDir = new File(project.buildDir, "rebuildChannel/release")
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants