Questions tagged [shrinkresources]
28 questions
29
votes
10 answers
Removing unused resources requires unused code shrinking to be turned on
I am preparing to release an App to production. So, I generated signed apk. After generating signed apk, I was getting a problem. My apk file size is a little large and I tried ways to shrink the apk size. I already tried
app --> Refactor -->…

ZarNi Myo Sett Win
- 1,353
- 5
- 15
- 37
14
votes
2 answers
shrinkResources set to true, but all unused resources (specifically drawables) not getting removed
I'm setting shrinkResources to true as follows:
releasepro {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationIdSuffix ".pro"
}
But this is…

Viral Patel
- 32,418
- 18
- 82
- 110
8
votes
1 answer
Android: How to tell ShrinkResources to keep certain resources
I have an mp3 and an ogg file in my res/raw folder which I used with Android Media Player. I used setDataSource like so
musicPlayer.setDataSource(context, Uri.parse("android.resource://com.me.myapp/" + R.raw.music));
This works fine when running…

Zippy
- 3,826
- 5
- 43
- 96
8
votes
3 answers
Android: Make "shrinkResources true" to keep all drawables, but remove other unused resources
I have a project which contains a lot of drawables, which are named starting with "a" or "b" (For example a1_back, a2_back, b1_start, b2_start and many-many more). Those drawables are not used in code, but used by the following code:
String name =…

hkop
- 304
- 3
- 9
6
votes
1 answer
Unknown Source when I use Proguard
My crash report is a little bit useless if I use Proguard (minifyEnabled true and shrinkResources true)
This is the report with Proguard:
java.lang.NullPointerException: Attempt to invoke virtual method 'void…

Ralph Bergmann
- 3,015
- 4
- 30
- 61
3
votes
1 answer
protect resources when using shrinkResources
I am trying out the new feature from the build-plugin - unfortunately it removes my sounds from res/raw even though they are referenced in the code. Is there a way to protect resources from being removed?
EDIT - after playing around a bit - it seems…

ligi
- 39,001
- 44
- 144
- 244
2
votes
0 answers
Android Studio 3.3.2 kotlin Compiler Warning
I am using,
Android Studio Version - 3.3.2
minSdkVersion 19
targetSdkVersion 27
Kotling plugin :
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
kotlin build file :
implementation…

Topsy
- 177
- 17
2
votes
0 answers
Shrink appcompat resources in Android
I would like to know how to remove appcompat resources.
To see my problem : In Android Studio, generate a new project with an empty Activity (backwards compatibility checked).
Enable shrinkResources in release build type.
buildTypes {
release…

Mursaat
- 48
- 6
2
votes
4 answers
ProGuard leads to NullPointerException
When setting minifyEnabled true in my gradle I get a NullPointerException when starting my app:
java.lang.RuntimeException: Unable to start activity ComponentInfo{de.ae.formulaecalendar/de.ae.formulaecalendar.view.calendar.CalendarActivity}:…

xani
- 784
- 1
- 7
- 21
1
vote
0 answers
Drawable not found when use shrinkResources true
menu_item": [
{
"item": "Something",
"sub_item": [
],
"icon": "ic_something",
"counter": ""
}
]
Here not found "icon": "ic_something"

Imtiaz
- 21
- 1
1
vote
1 answer
GeoNames and JDOM request java.rmi.RemoteException after shrinkResources
I'm using the GeoNames Java Client to autocomplete place names in an Android app: the user types some characters and a list of suggestions appears.
The library jdom-1.0.jar is also required, to parse the XML results that GeoNames fetch.
Everything…

Salvador
- 786
- 8
- 21
1
vote
1 answer
shrink resources does not work for libraries modules
I have some library modules in my application and there are a lot of resources that are unused. But they did not remove in release build.
minifyEnabled has been set true in release buildType and also shrinkResources has set true in app module.
Note:…

beigirad
- 4,986
- 2
- 29
- 52
1
vote
1 answer
Is there a way to get the list of resources deleted by shrinkResources?
As the title states, is there a way to know what resources was deleted by shrinkResources?
Thanks in advance :)

Archie G. Quiñones
- 11,638
- 18
- 65
- 107
1
vote
1 answer
Execution failed for task ':app:transformClassesWithAndroidGradleClassShrinkerForDebug'
I am getting this error because I tried to reduce my apk size by referring this document
Execution failed for task ':app:transformClassesWithAndroidGradleClassShrinkerForDebug'.
Warnings found during shrinking, please use -dontwarn or…

Naveen Kumar M
- 7,497
- 7
- 60
- 74
1
vote
1 answer
I need to use shrinkMode = "strict"
I need to use shrinkMode(strict).
I created a file keep.xml in category res/raw/keep.xml:

Adept
- 11
- 2