{"id":14979969,"url":"https://github.com/nameyuan/vasdollyu","last_synced_at":"2026-02-06T23:34:46.286Z","repository":{"id":57734281,"uuid":"370548497","full_name":"nameyuan/VasDollyU","owner":"nameyuan","description":"腾讯的多渠道打包方案，升级Gradle后的更新版本","archived":false,"fork":false,"pushed_at":"2021-06-01T06:32:22.000Z","size":341,"stargazers_count":1,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-09T06:04:53.619Z","etag":null,"topics":["android","apk","apksigner","apktool","gradle","v1","v2","vasdolly"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nameyuan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-25T03:06:54.000Z","updated_at":"2021-10-14T08:30:16.000Z","dependencies_parsed_at":"2022-09-26T22:11:01.005Z","dependency_job_id":null,"html_url":"https://github.com/nameyuan/VasDollyU","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nameyuan/VasDollyU","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nameyuan%2FVasDollyU","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nameyuan%2FVasDollyU/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nameyuan%2FVasDollyU/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nameyuan%2FVasDollyU/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nameyuan","download_url":"https://codeload.github.com/nameyuan/VasDollyU/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nameyuan%2FVasDollyU/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266785481,"owners_count":23983824,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","apk","apksigner","apktool","gradle","v1","v2","vasdolly"],"created_at":"2024-09-24T14:01:01.900Z","updated_at":"2026-02-06T23:34:46.259Z","avatar_url":"https://github.com/nameyuan.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![license](http://img.shields.io/badge/license-BSD3-brightgreen.svg?style=flat)](https://github.com/Tencent/VasDolly/blob/master/LICENSE)\n[![Release Version](https://img.shields.io/badge/release-2.0.3-red.svg)](https://github.com/Tencent/VasDolly/releases)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/VasDolly/pulls)\n[![wiki](https://img.shields.io/badge/Wiki-open-brightgreen.svg)](https://github.com/Tencent/VasDolly/wiki)\n---\n\n\n# 简介\nVasDolly是一种快速多渠道打包工具，同时支持基于V1签名和V2签名进行多渠道打包。插件本身会自动检测Apk使用的签名类别，并选择合适的多渠道打包方式，对使用者来说完全透明。 \n`V1.1.6`版本已支持Android Gradle Plugin 3.0，欢迎使用！\n\n目前Gradle Plugin 2.2以上默认开启V2签名，所以如果想关闭V2签名，可将下面的v2SigningEnabled设置为false。\n``` groovy\nsigningConfigs {\n        release {\n            ...\n            v1SigningEnabled true\n            v2SigningEnabled false\n        }\n\n        debug {\n            ...\n            v1SigningEnabled true\n            v2SigningEnabled false\n        }\n    }\n```\n\n# 接入流程\n\n## 添加对VasDolly Plugin的依赖\n在根工程的`build.gradle`中，添加对打包Plugin的依赖：\n``` groovy\ndependencies {\n        classpath 'com.android.tools.build:gradle:3.0.0'\n        classpath 'io.github.nameyuan:plugin:2.0.3'\n}\n```\n## 引用VasDolly Plugin\n在主App工程的`build.gradle`中，添加对VasDolly Plugin的引用：\n``` groovy\napply plugin: 'channel'\n```\n## 添加对VasDolly helper类库的依赖\n在主App工程的`build.gradle`中，添加读取渠道信息的helper类库依赖：\n``` groovy\ndependencies {\n    implementation 'io.github.nameyuan:helper:2.0.3'\n}\n```\n## 配置渠道列表\n目前有两种方式配置渠道列表，最终的渠道列表是两者的累加之和：\n1. 在`gradle.properties`文件指定渠道文件名称，该渠道文件必须位于根工程目录下，一行一个渠道信息。\n``` groovy\nchannel_file=channel.txt\n```\n2. 在`channel`或者`rebuildChannel`属性中通过`channelFile`属性指定渠道文件，一行一个渠道信息。\n``` groovy\nchannel{\n    //指定渠道文件\n    channelFile = file(\"/Users/leon/Downloads/testChannel.txt\")\n}\nrebuildChannel{\n    //指定渠道文件\n    channelFile = file(\"/Users/leon/Downloads/testReChannel.txt\")\n}\n```\n## 通过Gradle生成多渠道包\n### 直接编译生成多渠道包\n若是直接编译生成多渠道包，首先要配置渠道文件、渠道包的输出目录和渠道包的命名规则：\n``` groovy\nchannel{\n    //指定渠道文件\n    channelFile = file(\"/Users/leon/Downloads/testChannel.txt\")\n     //多渠道包的输出目录，默认为new File(project.buildDir,\"channel\")\n    baseOutputDir = new File(project.buildDir,\"xxx\")\n    //多渠道包的命名规则，默认为：${appName}-${versionName}-${versionCode}-${flavorName}-${buildType}\n    apkNameFormat ='${appName}-${versionName}-${versionCode}-${flavorName}-${buildType}'\n    //快速模式：生成渠道包时不进行校验（速度可以提升10倍以上，默认为false）\n    isFastMode = false\n    //buildTime的时间格式，默认格式：yyyyMMdd-HHmmss\n    buildTimeDateFormat = 'yyyyMMdd-HH:mm:ss'\n    //低内存模式（仅针对V2签名，默认为false）：只把签名块、中央目录和EOCD读取到内存，不把最大头的内容块读取到内存，在手机上合成APK时，可以使用该模式\n    lowMemory = false\n}\n```\n其中，多渠道包的命名规则中，可使用以下字段：\n\n* appName ： 当前project的name\n* versionName ： 当前Variant的versionName\n* versionCode ： 当前Variant的versionCode\n* buildType ： 当前Variant的buildType，即debug or release\n* flavorName ： 当前的渠道名称\n* appId ： 当前Variant的applicationId\n* buildTime ： 当前编译构建日期时间，时间格式可以自定义，默认格式：yyyyMMdd-HHmmss\n\n然后，通过`gradle channelDebug`、`gradle channelRelease`命令分别生成Debug和Release的多渠道包。\n\n为了方便临时生成渠道包进行测试，我们从`v2.0.0`开始支持添加渠道参数：`gradle channelDebug(channelRelease) -Pchannels=yingyongbao,gamecenter`，这里通过属性`channels`指定的渠道列表拥有更高的优先级，且和原始的文件方式是互斥的。\n\n### 根据已有基础包重新生成多渠道包\n若是根据已有基础包重新生成多渠道包，首先要配置渠道文件、基础包的路径和渠道包的输出目录：\n``` groovy\nrebuildChannel {\n  //指定渠道文件\n  channelFile = file(\"/Users/leon/Downloads/testReChannel.txt\")\n  baseDebugApk = 已有Debug APK    \n  baseReleaseApk = 已有Release APK\n  //默认为new File(project.buildDir, \"rebuildChannel/debug\")\n  debugOutputDir = Debug渠道包输出目录   \n  //默认为new File(project.buildDir, \"rebuildChannel/release\")\n  releaseOutputDir = Release渠道包输出目录\n  //快速模式：生成渠道包时不进行校验（速度可以提升10倍以上，默认为false）\n  isFastMode = false\n  //低内存模式（仅针对V2签名，默认为false）：只把签名块、中央目录和EOCD读取到内存，不把最大头的内容块读取到内存，在手机上合成APK时，可以使用该模式\n  lowMemory = false\n}\n```\n然后，通过`gradle rebuildChannel`命令生成多渠道包。\n\n为了方便临时生成渠道包进行测试，我们从`v2.0.0`开始支持添加渠道参数：`gradle rebuildChannel -Pchannels=yingyongbao,gamecenter`，这里通过属性`channels`指定的渠道列表拥有更高的优先级，且和原始的文件方式是互斥的。\n\n## 通过命令行生成渠道包、读取渠道信息\n从`V1.0.5`版本开始支持命令行，具体使用文档可参考`command`目录下的[README](https://github.com/Tencent/VasDolly/blob/master/command/README.md)。\n\n### 读取渠道信息\n通过helper类库中的`ChannelReaderUtil`类读取渠道信息。\n``` java\nString channel = ChannelReaderUtil.getChannel(getApplicationContext());\n```\n如果没有渠道信息，那么这里返回`null`，开发者需要自己判断。\n\n# Demo参考\n详细的接入范式，可参考[Demo](https://github.com/Tencent/VasDolly/tree/master/app)\n\n# 实现原理\n具体原理可参考[VasDolly实现原理](https://github.com/Tencent/VasDolly/wiki/VasDolly%E5%AE%9E%E7%8E%B0%E5%8E%9F%E7%90%86)\n\n# 问题反馈\n遇到任何问题或者有好的建议，欢迎提[issues](https://github.com/Tencent/VasDolly/issues)，或者QQ（1031747903）联系。\n\n# TODO\n\n1. 增加单元测试\n2. 防渠道信息篡改\n3. 提供Python脚本\n\n# License\nVasDolly is under the BSD license. See the [LICENSE](https://github.com/Tencent/VasDolly/blob/master/LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnameyuan%2Fvasdollyu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnameyuan%2Fvasdollyu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnameyuan%2Fvasdollyu/lists"}