Gradle plugin which automatically extracts hardcoded strings from Android layouts.
The plugin scans all your flavors and layouts. It automatically extracts detected hardcoded values. Occurrences are replaced with generated references:
<!-- Before, Layout: example.xml -->
<TextView
android:id="@+id/textView"
android:text="Hardcoded value"
/>
<!-- After -->
<TextView
android:id="@+id/textView"
android:text="@string/example_textView_text"
/>
buildscript {
repositories {
jcenter()
}
dependencies {
...
classpath 'de.ito.gradle.plugin:android-string-extractor:<version>'
}
}
apply plugin: 'android-string-extractor'
$ ./gradlew extractStringsFromLayouts
Contributing to this project is appreciated. Please check the contribution guidelines for more information.