it-objects/android-string-extractor-plugin


Gradle plugin which automatically extracts hardcoded strings from Android layouts.

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.it-objects:android-string-extractor-plugin:'
	}
	dependencies {
		implementation("com.github.it-objects:android-string-extractor-plugin:")
	}
	<dependency>
	    <groupId>com.github.it-objects</groupId>
	    <artifactId>android-string-extractor-plugin</artifactId>
	    <version></version>
	</dependency>

                            
    libraryDependencies += "com.github.it-objects" % "android-string-extractor-plugin" % ""
        
        

                            
    :dependencies [[com.github.it-objects/android-string-extractor-plugin ""]]
        
        

Readme


** THIS REPOSITORY IS OUTDATED SO THAT WE DECIDED TO ARCHIVE IT **

android-string-extractor-plugin Build Status Coverage Status Download

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"
  />

Usage

buildscript {
  repositories {
    jcenter()
  }
  dependencies {
    ...
    classpath 'de.ito.gradle.plugin:android-string-extractor:<version>'
  }
}

apply plugin: 'android-string-extractor'
$ ./gradlew extractStringsFromLayouts

Contributing

Contributing to this project is appreciated. Please check the contribution guidelines for more information.