stremetskyi-o/android-drawable-resizer


Gradle plugin for resizing Android drawables for lower screen densities

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.forsety:android-drawable-resizer:-SNAPSHOT'
	}
	dependencies {
		implementation("com.github.forsety:android-drawable-resizer:-SNAPSHOT")
	}
	<dependency>
	    <groupId>com.github.forsety</groupId>
	    <artifactId>android-drawable-resizer</artifactId>
	    <version>-SNAPSHOT</version>
	</dependency>

                            
    libraryDependencies += "com.github.forsety" % "android-drawable-resizer" % "-SNAPSHOT"
        
        

                            
    :dependencies [[com.github.forsety/android-drawable-resizer "-SNAPSHOT"]]
        
        

Readme


Android Drawable Resizer Gradle Plugin

This Gradle plugin will automatically resize Android drawables for lower screen densities, handling build types, flavors, source sets mapping and all your qualifiers. No more headache from sizing tons of images and storing them in your repository. Drawables are generated only when source drawable has changed and stored under the project 'build' folder.

Usage

  • From jcenter:
    • Add this to your Android project 'build.gradle' file
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.github.forsety:adr:0.1'
    }
}

apply plugin: 'com.github.forsety.adr'
  • From local Maven repository:
    • Import this project to your Android Studio and run 'install' gradle task. After this project will be available from your local Maven repository.
    • Add this to your Android project 'build.gradle' file
buildscript {
    repositories {
        mavenLocal()
    }
    dependencies {
        classpath 'com.github.forsety:adr:0.1'
    }
}

apply plugin: 'com.github.forsety.adr'

Note: Download and install JDK8 if you haven't already. Also set it as project default JDK and don't worry, your Android projects will build just fine.

Configuration

In your 'build.gradle' file add:

adr {
    minDensity "mdpi"
    baseDensity "xxhdpi"
    generateTvDpi false
}

Example shows default configuration, so if it suits your needs - you don't need configuration at all.