Disable Android resource / image / PNG optimization

后端 未结 6 1052
滥情空心
滥情空心 2020-12-14 01:56

How do I prevent the Android \"build process\" from optimizing .png images?

I have an Android project with the following res directories:

- /res/
- /         


        
6条回答
  •  佛祖请我去吃肉
    2020-12-14 02:56

    Finally there is an official way to disable the PNG cruncher with Gradle which hasn't been mentioned here yet:

    1. Edit main build.gradle to require gradle version 1.1.3 (or newer):

      buildscript {  
          repositories {  
              mavenCentral()  
          }  
          dependencies {  
              classpath 'com.android.tools.build:gradle:1.1.3'  
          }  
      }  
      
    2. In the individual apps's build.gradle, section android {}, insert:

      aaptOptions {  
          cruncherEnabled = false  
      }  
      

    Reference: https://code.google.com/p/android/issues/detail?id=65335

提交回复
热议问题