promeg / android-multi-channel-tool Goto Github PK
View Code? Open in Web Editor NEW基于Gradle的易用、快速、稳定的多渠道打包工具。
基于Gradle的易用、快速、稳定的多渠道打包工具。
该方法巧妙利用了Android系统在5.0之前忽略空文件签名的问题,实现了不需重新签名即可插入渠道信息的功能。
很遗憾,使用该方法生成的渠道包在Android 5.0及以后的手机上无法安装。
您好:我在moto x 5.0.2的手机上试验了,可以进行安装啊!
在debug模式下会有:
修改MultiChannelPlugin
的apply
方法,过滤debug
运行任务并取消删除原始apk
文件:
variants.all { variant ->
def runTasks = project.gradle.startParameter.taskNames
if (!('assemble' in runTasks || 'assembleRelease' in runTasks || 'aR' in runTasks)) {
return
}
def flavorName = variant.properties.get('flavorName')
....
// delete pkg
// variant.getOutputs().get(0).getOutputFile().delete()
目前里面是使用zip文件来遍历,找到channel文件,为什么不直接打开当前的assets文件呢?而且目前是读取最后一行,酱紫如果多一行换行,那会错误吧?
public static String getChannel(Context context, String preferenceName) {
String channelName = PreferenceManager.getDefaultSharedPreferences(context).getString(preferenceName, "");
if (!TextUtils.isEmpty(channelName)) {
return channelName;
}
InputStream channelInputStream = null;
try {
channelInputStream = context.getAssets().open("channel_info");
BufferedReader channelReader = new BufferedReader(new InputStreamReader(channelInputStream));
while (TextUtils.isEmpty(channelName)) {
channelName = channelReader.readLine();
if (channelName == null) {
break;
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (channelInputStream != null) {
try {
channelInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
if (!TextUtils.isEmpty(channelName)) {
PreferenceManager.getDefaultSharedPreferences(context).edit()
.putString(preferenceName, channelName).commit();
return channelName;
} else {
return "official";
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.