• liusar
  • Java
  • 3.1MB
  • zip
  • 0
  • 1 积分
  • 1
  • 2017-12-11 19:03
# AndResGuard [![Build Status](]( [![Jcenter Status](]( [![Android Arsenal](]( *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. **Note: Signature schemeV2 will make 7zip compressing invalid. If you really care about your APK size, please disable v2Signing in your signingConfigs** ## How to use ### With Gradle This has been released on `Bintray` ```gradle apply plugin: 'AndResGuard' buildscript { repositories { jcenter() } dependencies { classpath '' } } andResGuard { // mappingFile = file("./resource_mapping.txt") mappingFile = null // It will be invalid when you sign apk with schemeV2 use7zip = true useSign = true // it will keep the origin path of your resources when it's true keepRoot = false whiteList = [ // your icon "R.drawable.icon", // for fabric "*", // for google-services "R.string.google_app_id", "R.string.gcm_defaultSenderId", "R.string.default_web_client_id", "R.string.ga_trackingId", "R.string.firebase_database_url", "R.string.google_api_key", "R.string.google_crash_reporting_api_key" ] compressFilePattern = [ "*.png", "*.jpg", "*.jpeg", "*.gif", "resources.arsc" ] sevenzip { artifact = '' //path = "/usr/local/bin/7za" } } ``` 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`. The sevenzip can be set by `path` or `artifact`. Mutiple assignments are allowed, but the winner is **always** `path`. The outputted apk will be stored in `{App}/build/output/apk/AndResGuard_{apk_name}/{apk_name}_signed_7zip_aligned.apk`. **You can find more whitsList configs of third-part SDK in [](doc/ Welcome PR your configs which is not included in** 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 ``` [Looking for more detail](doc/ ## 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]( ## Thanks [Apktool]( Connor Tumbleson [v2sig]( @jonyChina162
    • ZJ_HorizontalScrollView.rar
      Android 实现Activity间横向滑屏。
    • android_calculate.rar
    • android调用相机和相册.zip
      android studio上可以进行手机摄像头和相册的调用
    • SwipeListViewDemo.rar
    • Android 倒计时实现源码.rar
      android recyclerview 的基本使用,欢迎大家下载学习!
      Musl是一个轻量级的C标准库,设计作为GNU C library (glibc)、 uClibc或Android Bionic的替代用于嵌入式操作系统和移动设备。它遵循POSIX 2008规格和 C99 标准,采用MIT许可证授权,使用Musl的Linux发行版和项目包括...
    • HarmonyOS和android-Hydrogen-Browser:氢浏览器
      Android 和鸿蒙操作系统上的移动浏览器。 发行说明 v0.3.0_alpha 发布日期:2021 年 6 月 4 日 优化:RecyclerView 重构设置页面 优化:将项目重构为不同的包 修复:退出应用程序时没有动画 v0.2.4_alpha 发布日期:...
    • BBS_system_on_java.rar
      BBS论坛系统由JAVA和JSP实现,开发中涉及JavaBean,JSP和服务器Tomcat5.0.7的设置,数据库用SQL2000。有注册登陆,浏览,发帖 回帖,帖子管理,论坛设置,管理版块,用户管理等模块。