All Projects → meili → Thinrplugin

meili / Thinrplugin

Licence: mit
去除android中的R.class

Programming Languages

java
68154 projects - #9 most used programming language
groovy
2714 projects

Projects that are alternatives of or similar to Thinrplugin

Gradle Js Plugin
Gradle plugin for working with JS
Stars: ✭ 376 (-40.51%)
Mutual labels:  gradle-plugin
Laziertracker
本项目通过Android字节码插桩插件实现Android端无埋点(或自动埋点),并且支持根据配置文件实现业务数据的自动采集。
Stars: ✭ 485 (-23.26%)
Mutual labels:  gradle-plugin
Gradle Task Tree
Gradle plugin that adds a 'taskTree' task that prints task dependency tree
Stars: ✭ 573 (-9.34%)
Mutual labels:  gradle-plugin
Gradle Static Analysis Plugin
Easy setup of static analysis tools for Android and Java projects.
Stars: ✭ 398 (-37.03%)
Mutual labels:  gradle-plugin
Gradle Test Logger Plugin
A Gradle plugin for printing beautiful logs on the console while running tests
Stars: ✭ 460 (-27.22%)
Mutual labels:  gradle-plugin
Can I Drop Jetifier
Gradle plugin that checks if there are dependencies using support library instead of AndroidX.
Stars: ✭ 520 (-17.72%)
Mutual labels:  gradle-plugin
Calces Gradle Plugin
Android构建工具集:包含快速实现组件化构建脚本,快速实现屏幕最小宽度适配脚本
Stars: ✭ 366 (-42.09%)
Mutual labels:  gradle-plugin
Scabbard
🗡 A tool to visualize Dagger 2 dependency graphs
Stars: ✭ 615 (-2.69%)
Mutual labels:  gradle-plugin
Gradle Download Task
Adds a download task to Gradle that displays progress information
Stars: ✭ 478 (-24.37%)
Mutual labels:  gradle-plugin
Gradle Git
Git plugin for Gradle
Stars: ✭ 559 (-11.55%)
Mutual labels:  gradle-plugin
Dependency Analysis Android Gradle Plugin
Gradle plugin for Java, Kotlin, and Android projects. Provides advice for managing dependencies and other applied plugins
Stars: ✭ 409 (-35.28%)
Mutual labels:  gradle-plugin
Bnd
Bnd/Bndtools. Tooling to build OSGi bundles including Eclipse, Maven, and Gradle plugins.
Stars: ✭ 446 (-29.43%)
Mutual labels:  gradle-plugin
Multi Os Engine
Multi-OS Engine: Create iOS Apps in Java (or Kotlin ... etc.)
Stars: ✭ 529 (-16.3%)
Mutual labels:  gradle-plugin
Androidautotrack
Android Asm 插桩 教学
Stars: ✭ 378 (-40.19%)
Mutual labels:  gradle-plugin
Android Junit5
Testing with JUnit 5 for Android.
Stars: ✭ 580 (-8.23%)
Mutual labels:  gradle-plugin
Axion Release Plugin
Gradle release & version management plugin.
Stars: ✭ 372 (-41.14%)
Mutual labels:  gradle-plugin
Gradle Tomcat Plugin
Gradle plugin supporting deployment of your web application to an embedded Tomcat web container
Stars: ✭ 516 (-18.35%)
Mutual labels:  gradle-plugin
Jsonschema2pojo
Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc
Stars: ✭ 5,633 (+791.3%)
Mutual labels:  gradle-plugin
Sdkhotfix
在用户规模千万级别的app中验证过,稳定无兼容问题,5分钟让你的SDK拥有热修复能力。A SDK hotfix library with stable verified in tens of millions of users can be accessed in only five minutes.
Stars: ✭ 585 (-7.44%)
Mutual labels:  gradle-plugin
Let
Annotation based simple API flavored with AOP to handle new Android runtime permission model
Stars: ✭ 532 (-15.82%)
Mutual labels:  gradle-plugin

ThinR gradle plugin

  • Other languages: [简体中文] (README.zh-cn.md) .

ThinR plugin introduce


This tool will remove all the class in R.java except the styleable class and replace the referance into the constant value. So you can reduce the dex files number and apk size.

The plugin has been used on the mogujie app, the apk size is reduced by 1MB (the original apk size of 40MB), the number of DEX reduced by 3.

ThinR plugin principle

In the R.java of android project , except the class styleable , all the class fields are int object and will never change the value in the run-time.

So in the compile-time we mark all the fields' name and their values,then use the asm tool to scan all the class files to replace the name into the value.

HOW TO USE


Add the dependency in the build.gralde of the project

classpath   'com.mogujie.gradle:ThinRPlugin:0.0.3'

Add the following code in the inner gradle file of the module :

 apply plugin: 'thinR'
 
 thinR {
     // In order not to affect the daily development of compilation speed, debug version can not delete R
   skipThinRDebug = true
 }

If you are using Proguard, please keep the R class in the confusion file.

-keepclassmembers class **.R$* {
	 public static <fields>;
}
-keep class **.R {*;}
-keep class **.R$* {*;}
-keep class **.R$*
-keep class **.R

if you are using ButterKnife either, please keep the R2 class in the confusion file.

-keepclassmembers class **.R2$* {
	 public static <fields>;
}
-keep class **.R2 {*;}
-keep class **.R2$* {*;}
-keep class **.R2$*
-keep class **.R2

Attention


The plugin does not support the pre-dex compilation model (i.e., one that must be turned on in multidex or Proguard)

Licence


ThinRPlugin is licensed under the MIT license

In case of using the issue to the [email protected] please!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].