• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ihrthk/android-gradle-mulchannel-plugin: Gradle plugin for generating multiple c ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

ihrthk/android-gradle-mulchannel-plugin

开源软件地址(OpenSource Url):

https://github.com/ihrthk/android-gradle-mulchannel-plugin

开源编程语言(OpenSource Language):

Groovy 58.2%

开源软件介绍(OpenSource Introduction):

android-gradle-mulchannel-plugin

Gradle plugin for multiple channel apks

demo

Contents

Overview

This plugin generates multiple apks from different channel. Generation has to be invoked as additions gradle task.

Supported features

  • inputFile-config input file
  • tempDir-config unzip dir
  • outputDir-config output dir
  • channels-config multiple channels

Theory

If adding empty file in "META-INF" directory, do not need to sign the application.Therefore, by adding different empty file for the application of the different channels, can be the only one channel.

Testing

demo Rate = 10apk/20sec(300apk/10min)

Use plugin

In Remote(Not need clone thie project to use,require gradle 2.1)

1.Add plugin declare in build.gradle file

plugins {
  id "me.zhangls.mulchannel" version "0.2"
}

2.Config mulchannel extension(inputFile,tempDir,outputDir,channels),eg:

mulchannel {
    inputFile = file('lite-cmxj-debug.apk')
    tempDir = file('temp')
    outputDir = file('out')
    channels = ["qihu360","baidu","yingyongbao","wandoujia","taobao","xiaomi","nearme","anzhuo","anzhi","meizu"]
}

3.Use gradle mulchannel to make multiple channel apks

In Local(Need clone this project to use)

1.Use gradle install command,To install the plug in local maven

2.Add dependency to the top-level build.gradle file.

  buildscript {
    repositories {
      maven {
        url "https://plugins.gradle.org/m2/"
      }
    }
    dependencies {
      classpath "gradle.plugin.me.zhangls:android-gradle-mulchannel-plugin:0.2"
    }
  }

3.Apply plugin and add configuration to build.gradle of the application, eg:

apply plugin: 'me.zhangls.mulchannel'

4.Config mulchannel extension(inputFile,tempDir,outputDir,channels),eg:

mulchannel {
    inputFile = file('lite-cmxj-debug.apk')
    tempDir = file('temp')
    outputDir = file('out')
    channels = ["qihu360","baidu","yingyongbao","wandoujia","taobao","xiaomi","nearme","anzhuo","anzhi","meizu"]
}

5.Use gradle mulchannel to make multiple channel apks

Get channel

  public static String getChannel(Context context) {
    ApplicationInfo appinfo = context.getApplicationInfo();
    String sourceDir = appinfo.sourceDir;
    String ret = "";
    ZipFile zipfile = null;
    try {
        zipfile = new ZipFile(sourceDir);
        Enumeration<?> entries = zipfile.entries();
        while (entries.hasMoreElements()) {
            ZipEntry entry = ((ZipEntry) entries.nextElement());
            String entryName = entry.getName();
            if (entryName.startsWith("META-INF/mulchannel")) {
                ret = entryName;
                break;
            }
        }
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        if (zipfile != null) {
            try {
                zipfile.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
  
    String[] split = ret.split("_");
    if (split != null && split.length >= 2) {
        return ret.substring(split[0].length() + 1);
  
    } else {
        return "";
    }
  }

Set channel

Will <meta-data android:value="Channel ID" android:name="UMENG_CHANNEL"/>
Channel ID replace the name of the marketing channels you apply
e.g. <meta-data android:value="Wandoujia" android:name="UMENG_CHANNEL"/>

If you don't want to in AndroidManifest.xml to config channel of umeng,you can also in Activity to config.
Please in launch activity to involved this method:AnalyticsConfig.setChannel(String channel)

Check signature

keytool -list -printcert -jarfile app.apk
The output will reveal the signature owner/issuer and MD5, SHA1 and SHA256 fingerprints.

License

MIT License See LICENSE file.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap