I had done my apps, any idea to minify the Android and Java code? can it save the apk file size and improve performance? compare to unminify source code.
Enable shrinkResources in your build type. Note that it requires minify to be enabled. In your Gradle file:
android {
buildTypes {
release {
minifyEnabled true
shrinkResources true
}
}
}
The accepted answer is now outdated, so I added this answer if someone else stumbles upon this question.
You can use ProGuard for this. Note however that your code will be obfuscated when it comes to crash reports etc so you need to keep obfuscation maps to be able to retrieve the stack traces between versions etc. It does however protect you a lot better from reverse engineering your .APK.
More info@Android Developers: http://developer.android.com/tools/help/proguard.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With