Other [new feature] Three birds with one stone

Status
Not open for further replies.

Erel

Administrator
Staff member
Licensed User
B4A v5.80 includes a new attribute named #ExcludeClasses.

Example:
B4X:
#ExcludeClasses: com.google.ads, anywheresoftware.b4a.phone.RingtoneManager
During compilation, all classes from all referenced libraries, that their full name (package + class) starts with one of the above prefixes, will not be included in the APK.

Why is it useful?
  1. Smaller APK, faster compilation and faster installation. This is especially useful when referencing the large google play services library.
  2. Removing libraries based on the selected build configuration. Like all other attributes you can use compilation symbols to add or remove this attribute.
  3. Removing unsupported classes. For example, Amazon rejects APKs that include the RingtoneManager classes. So instead of modifying the Phone library, you can exclude the problematic classes.
As google play services is the main candidate for this feature, any prefix that starts with a dot will be converted to google play services package (com.google.android.gms).

If you are only interested in the maps functionality of google play services:
B4X:
#ExcludeClasses: .games, .drive, .ads, .fitness, .wearable, .measurement, .cast, .auth, .nearby
#ExcludeClasses: .tagmanager, .analytics, .wallet, .plus, .vision, .gcm
 
Last edited:

MikeH

Well-Known Member
Licensed User
I like this ExcludeClasses attribute, thanks Erel.

Do you think an IncludeClasses attr would be possible so that instead of typing:

B4X:
#ExcludeClasses: .games, .drive, .fitness, .wearable, .measurement, .cast, .auth, .nearby, .tagmanager, analytics, .wallet, .plus, .vision, .gcm, .maps

when we only want ads we could instead type

B4X:
#IncludeClasses: .ads
 
Upvote 0

sorex

Expert
Licensed User
The best I could get was from 2MB > 1458K but I see there is still a lot of i mages (235K) included from Google Plus which was excluded.

Did they somehow sneak in with gms.internal?

Edit: must be the additional res line for admob that added it...
 
Upvote 0

Pendrush

Well-Known Member
Licensed User
Instead
B4X:
#ExcludeClasses: .games, .drive, .fitness, .wearable, .measurement, .cast, .auth, .nearby
#ExcludeClasses: .tagmanager, analytics, .wallet, .plus, .vision, .gcm, .maps
Use
B4X:
#ExcludeClasses: .games, .drive, .fitness, .wearable, .measurement, .cast, .auth, .nearby
#ExcludeClasses: .tagmanager, .analytics, .wallet, .plus, .vision, .gcm, .maps

Difference is DOT in front of word analytics
 
Upvote 0

sorex

Expert
Licensed User
@Erel ,

Can I use this on the core libs aswell?

Like using only the phone awake from the phone library to roll back some "install rights"

Edit: I see that it only added the "prevent phone from sleeping" when tagging the phone lib, which is fine.
 
Last edited:
Upvote 0

walterf25

Expert
Licensed User
I will continue to use ProGuard as it shrinks my APK automatically, but it's a great feature anyway. The new version is more and more attractive.
How can we use ProGuard?, is there any tutorials you can point us to so that we can try it as well?

Thanks,
Walter
 
Upvote 0

Informatix

Expert
Licensed User
Upvote 0
Status
Not open for further replies.
Top