AndResGuard-master.zip

  • liusar
    了解作者
  • Java
    开发工具
  • 3.1MB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 1
    下载次数
  • 2017-12-11 19:03
    上传日期
修改项目中资源文件的id名称,并创建新的关联,实现减小apk包的大小
AndResGuard-master.zip
内容介绍
# AndResGuard [![Build Status](https://travis-ci.org/shwenzhang/AndResGuard.svg?branch=master)](https://travis-ci.org/shwenzhang/AndResGuard) [![Jcenter Status](https://api.bintray.com/packages/simsun/maven/AndResGuard-gradle-plugin/images/download.svg)](https://bintray.com/simsun/maven/AndResGuard-gradle-plugin) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-AndResGuard-green.svg?style=true)](https://android-arsenal.com/details/1/3034) *Read this in other languages: [English](README.md), [简体中文](README.zh-cn.md).* `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 'com.tencent.mm:AndResGuard-gradle-plugin:1.2.3' } } 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 "R.string.com.crashlytics.*", // 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 = 'com.tencent.mm:SevenZip:1.2.3' //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 [white_list.md](doc/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 ``` [Looking for more detail](doc/how_to_work.md) ## 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](https://github.com/shwenzhang/AndResGuard/issues/162) ## Thanks [Apktool](https://github.com/iBotPeaches/Apktool) Connor Tumbleson [v2sig](https://github.com/shwenzhang/AndResGuard/pull/133) @jonyChina162
评论
    相关推荐
    • ZJ_HorizontalScrollView.rar
      Android 实现Activity间横向滑屏。
    • Android-LogCat-tool.zip
      LogCat是Android中一个命令行工具,可以用于得到程序的log信息,本附录讲解其使用方法和其中的一些技巧。
    • android_calculate.rar
      超级清爽android计算器界面源码,完成可用。可以供初学者参考。
    • android调用相机和相册.zip
      android studio上可以进行手机摄像头和相册的调用
    • SwipeListViewDemo.rar
      仿微信列表(ListView)滑动删除源码SwipeListViewDemo,效果也比较不错的,源码很清晰
    • Android 倒计时实现源码.rar
      实现倒计时功能,利用安卓平台在eclipse中运行
    • RecyclerViewTest.zip
      android recyclerview 的基本使用,欢迎大家下载学习!
    • musl-1.1.24.zip
      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。有注册登陆,浏览,发帖 回帖,帖子管理,论坛设置,管理版块,用户管理等模块。