8

I have problems in installing signed release version of my app on Android Wear. Some say it's because of Asset Compression.

How can I disable Asset Compression in gradle in android studio?

AVEbrahimi
  • 17,993
  • 23
  • 107
  • 210

2 Answers2

26

You can disable AAPT compression for given filetypes via an aaptOptions block in the android block of your build script:

android {
    ...
    aaptOptions {
       noCompress 'png'
    }
}

Having said that, it seems unlikely that disabling asset compression will solve your problem; the build system in most cases ought to be able to build a compatible app without resorting to arcane options. If turning off compression doesn't help, you can modify your question or ask a new one.

Scott Barta
  • 79,344
  • 24
  • 180
  • 163
  • For those using ant (command line) instead of gradle/Android Studio, see http://stackoverflow.com/a/8392543/1046167 – Louis Semprini Feb 25 '16 at 17:05
  • 4
    Is there anyway to tell it not to compress any of the assets? We need to be able to open file descriptor for all files in assets. – b.lyte Mar 15 '16 at 22:59
  • 1
    @clu check this https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.AaptOptions.html#com.android.build.gradle.internal.dsl.AaptOptions:noCompress – GBY Dec 01 '17 at 12:35
0

Per Packaging Asset Compression:

Android Studio doesn't compress your APK by default, but if you are using another build process, ensure that you don't doubly compress the wearable app.

This is not an issue if you are using Android Studio and the wearApp directive in your build.gradle file.

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443