All Projects → zhaoyubetter → AndroidResourceTools

zhaoyubetter / AndroidResourceTools

Licence: other
Android resource rename plugin.

Programming Languages

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

Projects that are alternatives of or similar to AndroidResourceTools

javacard-gradle-plugin
🔑 Gradle plugin for JavaCard development
Stars: ✭ 24 (-41.46%)
Mutual labels:  gradle-plugin
gradle-localization-plugin
Gradle plugin for automating the download process of localization files.
Stars: ✭ 19 (-53.66%)
Mutual labels:  gradle-plugin
KotlinCompilerPluginExample
This is an example project that shows how to create a Kotlin Compiler Plugin. The plugin will print "Hello from" and the name of the file that is being compiled, as a compiler warning to the terminal log.
Stars: ✭ 43 (+4.88%)
Mutual labels:  gradle-plugin
stater
Android library for easy save data to bundle in Activity/Fragment.
Stars: ✭ 12 (-70.73%)
Mutual labels:  gradle-plugin
ShieldAuto
🛡️ ShieldAuto is a Java based Gradle plugin to manage proguard config for release builds
Stars: ✭ 31 (-24.39%)
Mutual labels:  gradle-plugin
gradle-build-info-plugin
Gradle plugin to include build information such as Git commit ID to your JAR. It can be used to show Git commit information with Spring Boot Actuator.
Stars: ✭ 33 (-19.51%)
Mutual labels:  gradle-plugin
ank
ΛNK: Compile time docs verification and evaluation for Kotlin and Java (Temporarily moved to Arrow-kt)
Stars: ✭ 52 (+26.83%)
Mutual labels:  gradle-plugin
sonatype-publish-plugin
Gradle Plugin for publishing artifacts to Sonatype and Nexus
Stars: ✭ 17 (-58.54%)
Mutual labels:  gradle-plugin
removeRes
一键移除Android项目中没有使用到的资源文件和Xml元素声明
Stars: ✭ 16 (-60.98%)
Mutual labels:  gradle-plugin
gradle-helm-plugin
A Gradle plugin for building, publishing and managing Helm charts.
Stars: ✭ 42 (+2.44%)
Mutual labels:  gradle-plugin
feature-flag-android
A Gradle plugin to achieve feature flag based development for Android applications.
Stars: ✭ 82 (+100%)
Mutual labels:  gradle-plugin
sphinx-gradle-plugin
Sphinx site generation plugin for Gradle
Stars: ✭ 19 (-53.66%)
Mutual labels:  gradle-plugin
ManaDrop
A Gradle plugin for Minecraft development
Stars: ✭ 20 (-51.22%)
Mutual labels:  gradle-plugin
VanillaGradle
A toolchain for Minecraft: Java Edition that builds a workspace to interact with the game using the official mappings provided to the public by Mojang Studios.
Stars: ✭ 61 (+48.78%)
Mutual labels:  gradle-plugin
SetupBuilder
Gradle plugin for building setups for different platforms.
Stars: ✭ 75 (+82.93%)
Mutual labels:  gradle-plugin
Shot
Screenshot testing library for Android
Stars: ✭ 951 (+2219.51%)
Mutual labels:  gradle-plugin
kotest-gradle-plugin
A gradle plugin for Kotest
Stars: ✭ 18 (-56.1%)
Mutual labels:  gradle-plugin
poetimizely
Generate Kotlin type safe accessors for Optimizely experiments and features
Stars: ✭ 17 (-58.54%)
Mutual labels:  gradle-plugin
gradle-izpack-plugin
Gradle plugin that provides support for packaging applications for the Java platform via IzPack.
Stars: ✭ 60 (+46.34%)
Mutual labels:  gradle-plugin
gatling-gradle-plugin-demo
Showcase of the Gatling Plugin for Gradle
Stars: ✭ 17 (-58.54%)
Mutual labels:  gradle-plugin

AndroidResourceTools

因为模块化开发时,android 的资源名称(除id外)是不能重名的,如果手动修改,很繁琐; 本插件的目的:重命名Android 资源名称与资源文件名;方便模块化开发;

效果展示

效果展示

使用说明

  1. 在项目的根目录build.gradle,添加依赖如下
dependencies {
	...
	classpath 'com.github.better.restools:ResTools:1.0.1'
}
  1. 在对应的 module 下 build.gradle下,apply 插件,如下:
apply plugin: 'com.android.application'
apply plugin: 'plugin.resTools'  // 资源重命名插件

// 配置插件dsl
resConfig {
    new_prefix = 'better_'  // 资源前缀
    old_prefix = ''         // 老前缀,可为''空字符串
    // === below use default
    // resFolderPath 资源目录
    // srcFolderPath 源代码目录
    // manifestFilePath 清单文件目录
}
  1. clean 工程后,可以发现,在对应的 module 下,可发现 resourcetools task 组,展开,点击「replaceResName」 执行;

特别说明(特别重要)

  1. 因是直接替换文件,千万不要在主分支,主开发分支使用,建议使用新分支,测试ok后,合并;
  2. 目前插件没有加入文件事务处理,即:不能实现要么全部成功,要么全部失败;

1.0.1 版本支持的资源如下:

通过分析Android工程,分析得出Android App 工程的资源分为2大类:

  • 文件夹类型;
  • values类型(目前values类型,尚不支持 attrs 与 styles);
资源类型 源代码中 xml引用中 备注
layout R.layout.XXX
import kotlinx.android.synthetic.main.xxx.*
@layout/XXX 布局文件
kotlin导入布局时,重名支持
drawable R.drawable.XXX @drawable/XXX
anim R.anim.XXX @anim/XXX
color R.color.XXX @color/XXX
mipmap R.mipmap.XXX @mipmap.XXX
menu R.menu.XXX Xml 暂无引用
raw R.raw.XXX Xml 暂无引用
xml R.xml.XXX Xml 暂无引用
string R.string.XXX @string/XXX
color R.color.XXX @color/XXX
dimens R.dimen.XXX @dimen/XXX
arrays R.array.XXX @array/XXX
style R.style.XXX @style/XXX 需要考虑到parent,比较复杂
attr R.attr.XXX 需要特殊处理,主要在自定义属性上

TODO

  1. 文件的事务操作有待支持;
  2. Attrs 有待支持;
  3. style有待支持;
  4. 其他资源类型有待支持;
  5. 如果资源名称与Android自带资源名重复时,会发生替换问题,此问题,有待修正;
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].