Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
A

AndResGuard

> 编程语言
Open source

proguard resource for Android by wechat team

8.7K stars0 likes1 views
WebsiteGitHub

About

proguard resource for Android by wechat team

AndResGuard

Read this in other languages: English, 简体中文.

AndResGuard is a tooling for reducing your apk size, it works like the ProGuard for Java source code, but only aim at the resource files. It changes res/drawable/wechat to r/d/a, and renames the resource file wechat.png to a.png. Finally, it repackages the apk with 7zip, which can reduce the package size obviously.

AndResGuard is fast, and it does NOT need the source codes. Input an Android apk, then we can get a 'ResGuard' apk in a few seconds.

Some uses of AndResGuard are:

  1. Obfuscate android resources. It contains all the resource type(such as drawable、layout、string...). It can prevent your apk from being reversed by Apktool.

  2. Shrinking the apk size. It can reduce the resources.arsc and the package size obviously.

  3. Repackage with 7zip. It supports repackage apk with 7zip, and we can specify the compression method for each file.

AndResGuard is a command-line tool, it supports Windows, Linux and Mac. We suggest you to use 7zip in Linux or Mac platform for a higher compression ratio.

How to use

With Gradle

This has been released on Bintray

…

Wildcard

The whiteList and compressFilePattern support wildcard include ? * +.

?	Zero or one character
*	Zero or more of character
+	One or more of character

WhiteList

You need put all resource which access via getIdentifier into whiteList. You can find more whitsList configs of third-part SDK in white_list.md. Welcome PR your configs which is not included in white_list.md

The whiteList only works on the specsName of resources, it wouldn't keep the path of resource. If you wanna keeping the path, please use mappingFile to implement it.

For example, we wanna keeping the path of icon, we need add below into our mappingFile.

res path mapping:
    res/mipmap-hdpi-v4 -> res/mipmap-hdpi-v4
    res/mipmap-mdpi-v4 -> res/mipmap-mdpi-v4
    res/mipmap-xhdpi-v4 -> res/mipmap-xhdpi-v4
    res/mipmap-xxhdpi-v4 -> res/mipmap-xxhdpi-v4
    res/mipmap-xxxhdpi-v4 -> res/mipmap-xxxhdpi-v4

How to Launch

If you are using Android Studio, you can find the generate task option in andresguard group. Or alternatively, you run ./gradlew resguard[BuildType | Flavor] in your terminal. The format of task name is as same as assemble.

Sevenzip

The sevenzip in gradle file can be set by path or artifact. Multiple assignments are allowed, but the winner is always path.

Result

If finalApkBackupPath is null, AndResGuard will overwrite final APK to the path which assemble[Task] write. Otherwise, it will store in the path you assigned.

Other

Looking for more detail

Known Issue

  1. The first element of list which returned by AssetManager#list(String path) is empty string when you're using the APK which is compressed by 7zip. #162

Best Practise

  1. Do NOT add resources.arsc into compressFilePattern unless the app size is really matter to you.(#84 #233)
  2. Do NOT enable 7zip compression(use7zip) when you distribute your APP on Google Play. It'll prevent the file-by-file patch when updating your APP. (#233)

Thanks

Apktool Connor Tumbleson

v2sig @jonyChina162

Issues· 167 open

View all issuesOpen on GitHub
  • #525

    是否有计划支持AGP8+

    Updated Jun 4, 2025
  • #531

    Broken badge downloads

    Updated May 16, 2025
  • #520

    更新Gradle7.4.2 编译报错

    Updated Apr 21, 2025
  • #467

    安卓studio 4.2.0打包问题

    Updated Jul 24, 2024
  • #530

    kotlin 1.8.0不支持

    Updated Jan 23, 2024
  • #471

    Could not find SevenZip-1.2.17-osx-aarch_64.exe (com.tencent.mm:SevenZip:1.2.21).

    Updated Jan 11, 2024
  • #476

    Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes

    Updated Jan 4, 2024
  • #499

    支持agp7.0吗

    Updated Nov 3, 2023
  • #529

    The Crashlytics build ID is missing. This occurs when the Crashlytics Gradle plugin is missing from your app's build configuration.

    Updated Nov 3, 2023
  • #515

    系统自定义字体实现方式引发的问题。

    Updated Sep 22, 2023

> Tags

Java

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 30, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言