Signed apk/bundle taking too much of time from my android studio - android

I am trying to take singed apk build but generating the build getting too much of time (nearly 30 min)
build.gradle:
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

Set to false these line if you are not using proguard rule file
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

Related

Unable to Obfuscate the Android library .aar file using Ionic 6/Cordova

I have created the .aar(Android library) for ionic 6/cordova project. But unable to obfuscate the java class files, i.e, able to see the content of the file. Below is the configuration used in app level build.gradle.
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro'
debuggable false
}
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
It would be great if some one help on this?

Generating signed apk stucks when minifyEnabled true is used

While generating releases apk with minify enabled true ,gradle build doesn't finish and stucks at app:crashlyticsUploadDeobsRelease.
gradle build log
Replace your build Types code with this code in app level gradle file. when you are debugging or running code on your device before final release then select built variant debug and when you are going to built signed apk for release then select built variant release
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

Android debugger does not stop at breakpoints after minifyEnabled false

The debugger does not stop on any breakpoints. I tried clearing all breakpoints and adding them back in but I am seeing debug statements in the console.
According to this answer, Inside build.gradle for your app module, disable minifyEnable for my build variant and change it to false.
debug {
debuggable true
minifyEnabled false
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
I did it also but also but still same problem.
Since you're in debug configuration you don't need to shrink resources or add proguard
debug {
debuggable true
minifyEnabled false
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
change to
debug {
debuggable true
minifyEnabled false
// shrinkResources true
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

Android proguarded apk still readable

I tried to proguard my app. It successfully obfuscated the apk. However, when i try to view the java code of my apk using Apk_oneclick, I am able to. I have created a release version of my apk. Still the problem persist. Any help would be much appreciated.
Thanks in advance.
build.gradle:
Proguard Rules:
Java code from the release-apk:
For enabling ProGuard configurations for your application you need to enable it in your module level gradle file. you need to set the value of minifyEnabled true.
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
You can also enable shrinkResources true which will remove resources that ProGuard flaggs as unused.
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
You need to set following property
and add some rules in proguard-android
buildTypes {
release {
debuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Got it working. Cleaned the project and ran the same with some changes in the Proguard rules.

Debug APK size 25% smaller than Release (both with Proguard)

The debug APK we generated is 30 MB, while on the other hand, the release APK is 40 MB
Both uses the same proguard and gradle config, as below :
buildTypes {
release {
debuggable false
minifyEnabled true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig getSigningConfig()
}
debug {
debuggable true
minifyEnabled true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig getSigningConfig()
}
}
Please leave a comment if you need more code to analyze this problem
Thanks

Categories

Resources