app\build.gradle 中添加
// Make sure this line comes *after* you apply the Android plugin (apply plugin: 'com.android.application') apply plugin: 'org.fabiomsr.drawableoptimizer'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.fabiomsr:drawable-optimizer-gradle-plugin:1.0.4'
}
}
drawableOptimizer { optimizer = 'zopfli' compressionLevel = 9 iterations = 15 onlyOnRelease = true logLevel = 'info' }
Parameter | Description | Values | Default Value |
---|---|---|---|
optimizer | Compressor to use | zopfli or pngtastic | zopfli |
compressionLevel | Compression level (useful for pngtastic compressor) | 0-9 allowed | Brute forces with every allowed value |
iterations | Compression iterations number (useful for zopfli) | > 0 | 15 |
onlyOnRelease | Only release signed optimization | true or false | false |
logLevel | Output Logging level | none, debug, info or error | info |