'Android app using Proguard & R8 differences [closed]
In my android app i am using Google R8
(experimental release for now) and Proguard 6.0.3
...
According to your experience, what do you think ? What is the main difference ?
With R8
my app is smaller in size and the speed of process compared to Proguard
is really much better. Number of classes when using R8
are smaller comparing to Proguard
.
R8 is compatible with existing Proguard rules , but it ignore some like :
Ignoring option: -optimizationpasses"
Ignoring option: -assumenoexternalreturnvalues"
Ignoring option: -assumenoexternalsideeffects"
it gives just warning too for missing classes not errors for example :
AGPBI: {"kind":"warning","text":"Missing class: sun.net.www.protocol.http.HttpURLConnection","sources":[{}],"tool":"D8"}
AGPBI: {"kind":"warning","text":"Missing class: com.sun.net.httpserver.HttpHandler","sources":[{}],"tool":"D8"}
AGPBI: {"kind":"warning","text":"Missing class: org.dbunit.dataset.datatype.DefaultDataTypeFactory","sources":[{}],"tool":"D8"}
AGPBI: {"kind":"warning","text":"Missing class: com.inmobi.ads.InMobiNative$NativeAdListener","sources":[{}],"tool":"D8"}
AGPBI: {"kind":"warning","text":"Missing class: javax.enterprise.util.AnnotationLiteral","sources":[{}],"tool":"D8"}
AGPBI: {"kind":"warning","text":"Missing class: sun.net.www.protocol.http.Handler","sources":[{}],"tool":"D8"}
AGPBI: {"kind":"warning","text":"Missing class: com.flurry.android.ads.FlurryAdNativeListener","sources":[{}],"tool":"D8"}
AGPBI: {"kind":"warning","text":"Missing class: sun.net.spi.nameservice.NameServiceDescriptor","sources":[{}],"tool":"D8"}
AGPBI: {"kind":"warning","text":"Missing class: java.lang.ClassValue","sources":[{}],"tool":"D8"}
So in general i think that R8
is much better than Proguard
regardless for the fact that it is still experimental version.
Google say :
R8 is a Proguard replacement for whole program minification and optimization.
and i think this is really true.
But how this tools works in details ? What makes main the difference between each other and how the R8 works in deep ?
UPDATE :
After update to Android Studio 3.3 Canary 2 , when using R8 seems that size of APK doesn't have any difference from using Proguard
p.s : sorry for my English :) :) :)
UPDATE (14-MAR-2019) :
Latest R8 version for the moment V. 1.4.71
seems really good, faster than Proguard and when comparing generated Apk/Bundle from R8, the size is smaller. Also DEX method counts are smaller too.
I am using R8 Shrinker in production and everything seems very promising. Great Job really.
UPDATE (08-APRIL-2019) :
Latest R8 version for the moment V. 1.4.79
seems really good, faster than Proguard and when comparing generated Apk/Bundle from R8, the size is smaller. Also DEX method counts are smaller too.
I am using R8 Shrinker in production and everything seems very promising. Great Job really.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|