Convert Figma logo to code with AI

Tencent logoVasDolly

Android V1 and V2 Signature Channel Package Plugin

3,054
385
3,054
21

Top Related Projects

8,125

A powerful Android Dynamic Component Framework.

1,366

A hotfix library for Android platform, and not just this...

6,752

Android Signature V2 Scheme签名下的新一代渠道包打包神器

A powerful and lightweight plugin framework for Android

1,667

🔥🔥Qigsaw ['tʃɪɡsɔ] is a dynamic modularization library which is based on Android App Bundles(Do not need Google Play Service). It supports dynamic delivery for split APKs without reinstalling the base one.

Quick Overview

VasDolly is an Android channel packaging tool developed by Tencent. It allows for fast, efficient, and secure channel packaging of Android APKs without the need for recompilation or re-signing. VasDolly supports both V1 and V2 signing schemes and is compatible with various channel identification methods.

Pros

  • Fast and efficient channel packaging without recompilation
  • Supports both V1 and V2 signing schemes
  • Compatible with various channel identification methods
  • Provides both command-line tools and Gradle plugin for integration

Cons

  • Limited to Android APK packaging
  • May require additional setup for complex channel configurations
  • Documentation is primarily in Chinese, which may be challenging for non-Chinese speakers
  • Potential learning curve for developers unfamiliar with channel packaging concepts

Code Examples

  1. Using VasDolly in a Gradle build script:
apply plugin: 'com.tencent.vasdolly'

vasdolly {
    enable true
    channelFile = file("channel.txt")
    apkPath = 'app-release.apk'
    outputDir = file("${project.buildDir}/outputs/channels")
    channelVerify = true
}
  1. Reading channel information from an APK:
String channel = ChannelReader.getChannel(context);
if (channel != null) {
    Log.d("VasDolly", "Channel: " + channel);
} else {
    Log.e("VasDolly", "No channel info found");
}
  1. Writing channel information to an APK using the command-line tool:
java -jar VasDolly.jar put -c channel.txt /path/to/your.apk

Getting Started

  1. Add VasDolly to your project's build.gradle:
buildscript {
    dependencies {
        classpath 'com.tencent.vasdolly:plugin:3.0.4'
    }
}

apply plugin: 'com.tencent.vasdolly'
  1. Configure VasDolly in your app's build.gradle:
vasdolly {
    enable true
    channelFile = file("channel.txt")
    apkPath = 'app-release.apk'
    outputDir = file("${project.buildDir}/outputs/channels")
}
  1. Create a channel.txt file with your channel names, one per line.

  2. Run the Gradle task to generate channel APKs:

./gradlew channelPackage

Competitor Comparisons

8,125

A powerful Android Dynamic Component Framework.

Pros of Atlas

  • Comprehensive dynamic component framework for Android apps
  • Supports hot-fixing and dynamic deployment of components
  • Provides a complete set of tools for building, packaging, and deploying

Cons of Atlas

  • More complex setup and learning curve compared to VasDolly
  • Requires deeper integration into the app architecture
  • May introduce overhead for smaller projects

Code Comparison

Atlas (Component declaration):

@AtlasBundle(coverageRate = 0.9f)
public class SampleBundle {
    // Bundle implementation
}

VasDolly (Channel writing):

ChannelWriter.put(apkFile, channelFile, channel)

Key Differences

  • Atlas focuses on modularization and dynamic component management
  • VasDolly specializes in APK channel packaging and signature protection
  • Atlas offers a more comprehensive solution for large-scale app development
  • VasDolly provides a simpler, targeted approach for channel management

Use Cases

  • Atlas: Large-scale Android apps requiring modular architecture and dynamic updates
  • VasDolly: Apps needing efficient channel packaging and distribution management

Both projects serve different purposes in the Android development ecosystem, with Atlas offering a more extensive framework for app architecture and VasDolly providing a focused solution for channel packaging.

1,366

A hotfix library for Android platform, and not just this...

Pros of Amigo

  • Supports hot-fixing and incremental updates, allowing for more flexible app maintenance
  • Provides a comprehensive solution for Android app updates and patching
  • Offers a wider range of features beyond channel packaging

Cons of Amigo

  • More complex setup and integration process
  • Requires deeper understanding of Android development for effective use
  • May have a steeper learning curve for beginners

Code Comparison

VasDolly (Channel packaging):

ChannelWriter.put(apkFile, channelFile, channel)

Amigo (Hot-fix application):

Amigo.work(this);
Amigo.workLater(this, hours);
Amigo.setWorkLater(false);

Key Differences

  • VasDolly focuses primarily on channel packaging for Android apps
  • Amigo offers a broader set of features for app updates and maintenance
  • VasDolly is generally simpler to use for its specific purpose
  • Amigo provides more advanced capabilities but may require more setup

Use Cases

  • Choose VasDolly for straightforward channel packaging needs
  • Opt for Amigo when requiring comprehensive app update and patching solutions

Community and Support

  • Both projects are open-source and maintained by reputable organizations
  • VasDolly may have more focused support for channel-related issues
  • Amigo's broader feature set may attract a more diverse community
6,752

Android Signature V2 Scheme签名下的新一代渠道包打包神器

Pros of walle

  • More comprehensive documentation and usage examples
  • Supports multiple channels and custom channel configurations
  • Provides a Gradle plugin for easier integration

Cons of walle

  • Limited to Android platform only
  • Requires more setup and configuration compared to VasDolly
  • Less frequent updates and maintenance

Code Comparison

walle:

apply plugin: 'walle'

walle {
    apkOutputFolder = new File("${project.buildDir}/outputs/channels")
    apkFileNameFormat = '${appName}-${packageName}-${channel}-${buildType}-v${versionName}-${versionCode}'
    channelFile = new File("${project.getProjectDir()}/channel")
}

VasDolly:

ChannelWriter.put(apkFile, channelName, extraInfo);
List<String> channelList = ChannelReader.getChannelList(apkFile);
String channel = ChannelReader.get(apkFile);

Both tools aim to solve the problem of channel packaging for Android apps, but they differ in their approach and features. walle offers more flexibility and customization options, while VasDolly provides a simpler, more straightforward implementation. The choice between the two depends on the specific requirements of your project and the level of control you need over the channel packaging process.

A powerful and lightweight plugin framework for Android

Pros of VirtualAPK

  • Supports dynamic loading of complete APK files, allowing for more complex plugin architectures
  • Provides a more comprehensive solution for app virtualization and dynamic loading
  • Offers better isolation between host app and plugins

Cons of VirtualAPK

  • More complex setup and integration process
  • Potentially higher performance overhead due to its comprehensive nature
  • May require more frequent updates to maintain compatibility with Android OS changes

Code Comparison

VirtualAPK:

PluginManager pluginManager = PluginManager.getInstance(context);
pluginManager.loadPlugin(new File(apkPath));
Intent intent = new Intent();
intent.setClassName(packageName, activityName);
startActivity(intent);

VasDolly:

File channelApkFile = ChannelReaderUtil.getChannelApkFile(baseApk, channel);
if (channelApkFile != null) {
    installApk(context, channelApkFile);
}

VirtualAPK focuses on loading and running entire APKs as plugins, while VasDolly is primarily used for channel packaging and management. VirtualAPK's code demonstrates plugin loading and activity launching, whereas VasDolly's code shows channel-specific APK file handling.

1,667

🔥🔥Qigsaw ['tʃɪɡsɔ] is a dynamic modularization library which is based on Android App Bundles(Do not need Google Play Service). It supports dynamic delivery for split APKs without reinstalling the base one.

Pros of Qigsaw

  • Supports dynamic loading of features, allowing for more flexible app modularization
  • Provides a gradle plugin for easier integration and configuration
  • Offers runtime component replacement without app restart

Cons of Qigsaw

  • More complex setup and configuration compared to VasDolly
  • Requires deeper understanding of Android app architecture
  • May introduce additional overhead due to dynamic loading

Code Comparison

Qigsaw (Feature loading):

Qigsaw.installSplits(context, splitInfos) { success, exception ->
    if (success) {
        // Load feature
    }
}

VasDolly (Channel writing):

ChannelWriter.put(apkFile, channelFile, channel)

While both projects aim to improve Android app development, they serve different purposes. Qigsaw focuses on app modularization and dynamic feature loading, offering more flexibility but with increased complexity. VasDolly, on the other hand, specializes in multi-channel packaging and is simpler to use for that specific task. The choice between them depends on the project's requirements and the development team's expertise.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

license Release Version PRs Welcome wiki

简介

VasDolly是一种快速多渠道打包工具,同时支持基于V1签名和V2,V3签名进行多渠道打包。插件本身会自动检测Apk使用的签名类别,并选择合适的多渠道打包方式,对使用者来说完全透明。

目前Gradle Plugin 2.2以上默认开启V2签名,所以如果想关闭V2签名,可将下面的v2SigningEnabled设置为false。 关于应用签名说明:见官方文档

signingConfigs {
        release {
            ...
            v1SigningEnabled true
            v2SigningEnabled false
        }

        debug {
            ...
            v1SigningEnabled true
            v2SigningEnabled false
        }
    }

接入流程

添加对VasDolly Plugin的依赖

在根工程的build.gradle中,添加对打包Plugin的依赖:

dependencies {
        classpath 'com.android.tools.build:gradle:7.0.3'
        classpath 'com.tencent.vasdolly:plugin:3.0.6'
}

引用VasDolly Plugin

在主App工程的build.gradle中,添加对VasDolly Plugin的引用:

apply plugin: 'com.tencent.vasdolly'

添加对VasDolly helper类库的依赖

在主App工程的build.gradle中,添加读取渠道信息的helper类库依赖:

dependencies {
    api 'com.tencent.vasdolly:helper:3.0.6'
}

配置渠道列表

目前有两种方式配置渠道列表,最终的渠道列表是两者的累加之和:

  1. 在gradle.properties文件指定渠道文件名称,该渠道文件必须位于根工程目录下,一行一个渠道信息。
channel_file=channel.txt
  1. 在channel或者rebuildChannel属性中通过channelFile属性指定渠道文件,一行一个渠道信息。
channel{
    //指定渠道文件
    channelFile = file("/Users/leon/Downloads/testChannel.txt")
}
rebuildChannel{
    //指定渠道文件
    channelFile = file("/Users/leon/Downloads/testReChannel.txt")
}

通过Gradle生成多渠道包

直接编译生成多渠道包

若是直接编译生成多渠道包,首先要配置渠道文件、渠道包的输出目录和渠道包的命名规则:

channel{
    //指定渠道文件
    channelFile = file("/Users/leon/Downloads/testChannel.txt")
     //多渠道包的输出目录,默认为new File(project.buildDir,"channel")
    outputDir = new File(project.buildDir,"xxx")
    //多渠道包的命名规则,默认为:${appName}-${versionName}-${versionCode}-${flavorName}-${buildType}-${buildTime}
    apkNameFormat ='${appName}-${versionName}-${versionCode}-${flavorName}-${buildType}'
    //快速模式:生成渠道包时不进行校验(速度可以提升10倍以上,默认为false)
    fastMode = false
    //buildTime的时间格式,默认格式:yyyyMMdd-HHmmss
    buildTimeDateFormat = 'yyyyMMdd-HH:mm:ss'
    //低内存模式(仅针对V2签名,默认为false):只把签名块、中央目录和EOCD读取到内存,不把最大头的内容块读取到内存,在手机上合成APK时,可以使用该模式
    lowMemory = false
}

其中,多渠道包的命名规则中,可使用以下字段:

  • appName : 当前project的name
  • versionName : 当前Variant的versionName
  • versionCode : 当前Variant的versionCode
  • buildType : 当前Variant的buildType,即debug or release
  • flavorName : 当前的渠道名称
  • appId : 当前Variant的applicationId
  • buildTime : 当前编译构建日期时间,时间格式可以自定义,默认格式:yyyyMMdd-HHmmss

然后,通过gradle channelDebug、gradle channelRelease命令分别生成Debug和Release的多渠道包。

为了方便临时生成渠道包进行测试,我们从v2.0.0开始支持添加渠道参数:gradle channelDebug(channelRelease) -Pchannels=yingyongbao,gamecenter,这里通过属性channels指定的渠道列表拥有更高的优先级,且和原始的文件方式是互斥的。

根据已有基础包重新生成多渠道包

若是根据已有基础包重新生成多渠道包,首先要配置渠道文件、基础包的路径和渠道包的输出目录:

rebuildChannel {
  //指定渠道文件
  channelFile = file("/Users/leon/Downloads/testReChannel.txt")
  // 已有APK文件地址(必填),如new File(project.rootDir, "/baseApk/app_base.apk"),文件名中的base将被替换为渠道名
  baseApk = 已有APK文件地址(必填)
  //默认为new File(project.buildDir, "rebuildChannel")
  outputDir = 渠道包输出目录
  //快速模式:生成渠道包时不进行校验(速度可以提升10倍以上,默认为false)
  fastMode = false
  //低内存模式(仅针对V2签名,默认为false):只把签名块、中央目录和EOCD读取到内存,不把最大头的内容块读取到内存,在手机上合成APK时,可以使用该模式
  lowMemory = false
}

然后,通过gradle rebuildChannel命令生成多渠道包。

为了方便临时生成渠道包进行测试,我们从v2.0.0开始支持添加渠道参数:gradle rebuildChannel -Pchannels=yingyongbao,gamecenter,这里通过属性channels指定的渠道列表拥有更高的优先级,且和原始的文件方式是互斥的。

通过命令行生成渠道包、读取渠道信息

从V1.0.5版本开始支持命令行,具体使用文档可参考command目录下的README。

读取渠道信息

通过helper类库中的ChannelReaderUtil类读取渠道信息。

String channel = ChannelReaderUtil.getChannel(getApplicationContext());

如果没有渠道信息,那么这里返回null,开发者需要自己判断。

Demo参考

详细的接入范式,可参考Demo

实现原理

具体原理可参考VasDolly实现原理

问题反馈

遇到任何问题或者有好的建议,欢迎提issues

TODO

  1. 增加单元测试
  2. 防渠道信息篡改
  3. 提供Python脚本

License

VasDolly is under the BSD license. See the LICENSE file for details.