I am using android studio to build debug and release application. When i build debug/release application
./gradlew assembleDebug ./gradlew assembleRelease
both build are created perfectly and run as well. Shows appropriate dialog box for debug or release
now i have added proguard details in build.gradle:
signingConfigs { myConfig { storeFile file("keystore.jks") storePassword "abc123!" keyAlias "androidreleasekey" keyPassword "pqrs123!" } } buildTypes { release { runProguard true proguardFile getDefaultProguardFile('proguard-android-optimize.txt') signingConfig signingConfigs.myConfig } } productFlavors { defaultFlavor { proguardFile 'proguard-rules.txt' } }
Now it shows error in event log as
Warning: there were 7 unresolved references to classes or interfaces. You may need to add missing library jars or update their versions. If your code works fine without the missing classes, you can suppress the warnings with '-dontwarn' options. (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: there were 2 unresolved references to program class members. Your input classes appear to be inconsistent. You may need to recompile the code.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember) :Flash Sales:proguardDefaultFlavorRelease FAILED
If i turn the runProguard option to false then its running.
I have these questions:
1) is it ok to release apk with runProguard = false?
2) How to use dontwarn while creating release build?
To enable R8, open build. gradle module app file and add this piece of code inside the buildTypes . The code inside the release{} block means that this will be applied to the release build version of your application. If you launch the app in the emulator, this code is not executed.
R8 is having a faster processing time than Proguard which reduces build time. R8 gives better output results than Proguard. R8 reduces the app size by 10 % whereas Proguard reduces app size by 8.5 %. The android app having a Gradle plugin above 3.4.
I was trying to learn how to use ProGuard, and it is no way as easy as I thought. At first I found a simple Java code to try it, a simple two class Swing calculator. The code can be found by following that link, but I found it too verbose to post the it here. Anyway, it is a plain application with entry point on Calc.main (), there are no packages.
The ProGuard artifacts are hosted at Maven Central. When working on your Android application (apk, aab) or library (aar), you can include ProGuard in your Gradle build by: Using ProGuard's Gradle plugin, which you can apply in your build.gradle file.
List of ProGaurd options you can use to secure/optimize/test/debug/fix your app! For those who are new to ProGaurd, ProGuard is an open-sourced Java class file shrinker, optimizer, obfuscator, and preverifier. As a result, ProGuard processed applications and libraries are smaller, faster, and somewhat hardened against reverse engineering.
Choose ProGuard from the Code shrinker drop-down list on the Properties > Android Options window: For most Xamarin.Android apps, the default ProGuard configuration file supplied by Xamarin.Android will be sufficient to remove all (and only) unused code.
When I add new lib to project Generally this How I need to define for Progaurd.
Let's say I am using Twitter4J lib then I add dontwarn this way.
-keep class twitter4j.** { *; }
-dontwarn twitter4j.**
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