Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable asset compression in Android Studio

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?

like image 259
AVEbrahimi Avatar asked Dec 08 '14 08:12

AVEbrahimi


People also ask

How to create an asset folder in Android Studio?

Step 1: To create an asset folder in Android studio open your project in Android mode first as shown in the below image. Step 2: Go to the app > right-click > New > Folder > Asset Folder and create the asset folder. Step 3: Android Studio will open a dialog box.

How do i compress an APK without deflating it?

in launcher's build.gradle, locate aaptOptions.noCompress, add files which don't need to be compressed there. Then build the apk, you can then open that apk with tool like 7-zip, and check the compression method next to target file, it should be called "Store" instead of "Deflate"

How to resize and compress an image in Android?

In this article, you will learn how to resize and compress an image in Android. Resizing and compressing an image is sometimes very useful. Right-click on "layout" then select "New" -> "Layout resource file". Name this file as "splash_layout" and add the following code to it: Right-click on the package then select "New" -> "Java class".

How can I reduce the size of my App's Code?

This process can greatly reduce your app's size if, for example, your app includes many library dependencies but utilizes only a small part of their functionality. To shrink your app’s code, R8 first determines all entry points into your app’s code based on the combined set of configuration files .


1 Answers

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.

like image 106
Scott Barta Avatar answered Oct 24 '22 14:10

Scott Barta