• android 7.0 多渠道打包


    在Android 7.0(Nougat)推出了新的应用签名方案APK Signature Scheme v2后,之前快速生成渠道包的方式(美团Android自动化之旅—生成渠道包)已经行不通了,对此美团输出了新的开发渠道打包工具Walle,此篇博文针对使用Walle进行命令行打包的方式进行讲解。

    Walle 工具原理

    1. 对新的应用签名方案生成的APK包中的ID-value进行扩展,提供自定义ID-value(渠道信息),并保存在APK中
    2. 而APK在安装过程中进行的签名校验,是忽略我们添加的这个ID-value的,这样就能正常安装了
    3. 在App运行阶段,可以通过ZIP的EOCD(End of central directory)Central directory等结构中的信息(会涉及ZIP格式的相关知识,这里不做展开描述)找到我们自己添加的ID-value,从而实现获取渠道信息的功能

    使用该工具前提

      APK采用新的应用签名方案APK Signature Scheme v2!!!

      新的签名方案会在ZIP文件格式的 Central Directory 区块所在文件位置的前面添加一个APK Signing Block区块

      新的应用签名方案和旧的签名方案的一个对比:

    Walle 使用

    开源工具地址:https://github.com/Meituan-Dianping/walle

    命令行工具使用方式

      获取cli所有功能

        java -jar walle-cli-all.jar -h
    Usage: <main class> [options] [command] [command options]
      Options:
        -h, --help
           show walle command line help
           Default: false
        -v, --version
           show walle version
           Default: false
      Commands:
        batch2      channel apk batch production
          Usage: batch2 [options] inputFile [outputDirectory]
            Options:
              -f, --configFile
                 config file (json)
    
        show      get channel info from apk and show all by default
          Usage: show [options] file1 file2 file3 ...
            Options:
              -c, --channel
                 get channel
                 Default: false
              -e, --extraInfo
                 get channel extra info
                 Default: false
              -r, --raw
                 get raw string from Channel id
                 Default: false
    
        batch      channel apk batch production
          Usage: batch [options] inputFile [outputDirectory]
            Options:
              -f, --channelFile
                 channel file
              -c, --channelList
                 Comma-separated list of channel, eg: -c meituan,xiaomi
              -e, --extraInfo
                 Comma-separated list of key=value info, eg: -e time=1,type=android
    
        rm      remove channel info for apk
          Usage: rm [options] file1 file2 file3 ...
    
        put      put channel info into apk
          Usage: put [options] inputFile [outputFile]
            Options:
              -c, --channel
                 single channel, eg: -c meituan
              -e, --extraInfo
                 Comma-separated list of key=value info, eg: -e time=1,type=android
    

      

    使用示例

    获取信息

    显示当前apk中的渠道和额外信息:

    java -jar walle-cli-all.jar show /Users/Meituan/app/build/outputs/apk/app.apk

    写入信息

    写入渠道

    java -jar walle-cli-all.jar put -c meituan /Users/Meituan/Downloads/app.apk

    指定输出文件,自定义名称。 不指定时默认与原apk包同目录。

    java -jar walle-cli-all.jar put -c meituan /Users/Meituan/Downloads/app.apk /Users/xxx/Downloads/app-new-hahha.apk

    批量写入

    命令行指定渠道列表
    java -jar walle-cli-all.jar batch -c meituan,meituan2,meituan3 /Users/walle/app/build/outputs/apk/app.apk
    指定渠道配置文件
    java -jar walle-cli-all.jar batch -f /Users/Meituan/walle/app/channel  /Users/Meituan/walle/app/build/outputs/apk/app.apk
    配置文件示例 支持使用#号添加注释
    指定渠道&额外信息配置文件
    java -jar walle-cli-all.jar batch2 -f /Users/Meituan/walle/app/config.json  /Users/Meituan/walle/app/build/outputs/apk/app.apk
    

    配置文件示例

    输出目录可指定,不指定时默认在原apk包同目录下。

    Walle 工具使用完整过程

      加固没签名的包  ->   用buildtool中的apksigner签名(有同学反馈24不可以,25.0.0就可以了)  ->   用walle注入渠道

      有热心的同学也帮忙整理了步骤: 支持Android7.0 Signature V2 Scheme 多渠道打包,并解决类似360加固后获取不到渠道信息 - 渠道统计失败的问题

  • 相关阅读:
    题解——栈(卡特兰递归数的应用)
    题解——主的赦免(递归的进一步理解)
    sql开窗函数 row_number () over(order by id )
    c# resources
    Fillder 转载
    用javascript实现控制打开网页窗口的大小 和HTML如何关闭窗口的技巧大全
    datatable 与dataview的区别
    Asp.net中DataBinder.Eval用法的总结
    FrameSet左右收缩编码
    ajax get post
  • 原文地址:https://www.cnblogs.com/YatHo/p/6672484.html
Copyright © 2020-2023  润新知