Erel B4X founder Staff member Licensed User Longtime User Feb 4, 2016 #1 B4A v5.80 includes a new attribute named #ExcludeClasses. Example: Code: Copy #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? Smaller APK, faster compilation and faster installation. This is especially useful when referencing the large google play services library. Removing libraries based on the selected build configuration. Like all other attributes you can use compilation symbols to add or remove this attribute. 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: Code: Copy #ExcludeClasses: .games, .drive, .ads, .fitness, .wearable, .measurement, .cast, .auth, .nearby #ExcludeClasses: .tagmanager, .analytics, .wallet, .plus, .vision, .gcm Last edited: Feb 23, 2016
B4A v5.80 includes a new attribute named #ExcludeClasses. Example: Code: Copy #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? Smaller APK, faster compilation and faster installation. This is especially useful when referencing the large google play services library. Removing libraries based on the selected build configuration. Like all other attributes you can use compilation symbols to add or remove this attribute. 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: Code: Copy #ExcludeClasses: .games, .drive, .ads, .fitness, .wearable, .measurement, .cast, .auth, .nearby #ExcludeClasses: .tagmanager, .analytics, .wallet, .plus, .vision, .gcm
ArminKH Well-Known Member Feb 4, 2016 #2 isn't it better if unused classes removed automatically by compiler? like a future which is exist in b4a named Clean Project ? i know maybe this is headache(or not for u) when compiler need to looking for relations between classes and need it's own strategy,but u can have this in your mind as a wish for the next version of the next version. any way this is really great future at all and thank u. Upvote 0
isn't it better if unused classes removed automatically by compiler? like a future which is exist in b4a named Clean Project ? i know maybe this is headache(or not for u) when compiler need to looking for relations between classes and need it's own strategy,but u can have this in your mind as a wish for the next version of the next version. any way this is really great future at all and thank u.
DonManfred Expert Licensed User Longtime User Feb 4, 2016 #3 Erel said: The next version of B4A Click to expand... Do you know an ETA for the new B4A Version? Asking about the new CustomProperties for CusomViews-Feature in next B4A Version Upvote 0
Erel said: The next version of B4A Click to expand... Do you know an ETA for the new B4A Version? Asking about the new CustomProperties for CusomViews-Feature in next B4A Version
Erel B4X founder Staff member Licensed User Longtime User Feb 4, 2016 #4 ArminKH said: isn't it better if unused classes removed automatically by compiler? Click to expand... This feature allows you to strip out classes from the referenced jars not from your project. The compiler cannot know which classes are not required. DonManfred said: Do you know an ETA for the new B4A Version? Click to expand... The beta version will be released in a week or two. Upvote 0
ArminKH said: isn't it better if unused classes removed automatically by compiler? Click to expand... This feature allows you to strip out classes from the referenced jars not from your project. The compiler cannot know which classes are not required. DonManfred said: Do you know an ETA for the new B4A Version? Click to expand... The beta version will be released in a week or two.
Erel B4X founder Staff member Licensed User Longtime User Feb 4, 2016 #5 Another important new feature: CreateResource command in the manifest editor. Code: Copy SetApplicationAttribute("android:theme", "@style/AppTheme") CreateResource(values, theme.xml, <resources> <style name="AppTheme" parent="android:Theme.Material.Light"> <item name="android:colorPrimary">#FFEAC80E</item> <item name="android:colorPrimaryDark">#FFEA0ED7</item> <item name="android:colorAccent">#FFF8F8F8</item> </style> </resources> ) CreateResource creates an XML resource file. In the above example a file named theme.xml will be created under res\values. This makes it easier to customize the themes, all from the manifest editor. Remember that the manifest editor supports conditional compilation. So it is also possible to change the resources based on the selected build. Upvote 0
Another important new feature: CreateResource command in the manifest editor. Code: Copy SetApplicationAttribute("android:theme", "@style/AppTheme") CreateResource(values, theme.xml, <resources> <style name="AppTheme" parent="android:Theme.Material.Light"> <item name="android:colorPrimary">#FFEAC80E</item> <item name="android:colorPrimaryDark">#FFEA0ED7</item> <item name="android:colorAccent">#FFF8F8F8</item> </style> </resources> ) CreateResource creates an XML resource file. In the above example a file named theme.xml will be created under res\values. This makes it easier to customize the themes, all from the manifest editor. Remember that the manifest editor supports conditional compilation. So it is also possible to change the resources based on the selected build.
LucaMs Expert Licensed User Longtime User Feb 4, 2016 #6 Erel said: This feature allows you to strip out classes from the referenced jars not from your project. The compiler cannot know which classes are not required. Click to expand... I suppose you are sure about this. The compiler knows if a routine of a my class module is unused: cannot it "explore" the jar, search for unused public routines in the project and exclude them? [I also suppose, the answer: "No" ] Upvote 0
Erel said: This feature allows you to strip out classes from the referenced jars not from your project. The compiler cannot know which classes are not required. Click to expand... I suppose you are sure about this. The compiler knows if a routine of a my class module is unused: cannot it "explore" the jar, search for unused public routines in the project and exclude them? [I also suppose, the answer: "No" ]
lemonisdead Well-Known Member Licensed User Longtime User Feb 4, 2016 #7 LucaMs said: I also suppose, the answer: "No" Click to expand... Seems to be very costly since we can do it by hand Edit: sorry, what I mean is : the compiler should do this each compilation time // we do it one time when we create the app and can change it after to adapt Upvote 0
LucaMs said: I also suppose, the answer: "No" Click to expand... Seems to be very costly since we can do it by hand Edit: sorry, what I mean is : the compiler should do this each compilation time // we do it one time when we create the app and can change it after to adapt
Erel B4X founder Staff member Licensed User Longtime User Feb 4, 2016 #8 The full answer is that the compiler can strip unused classes but not without mistakes. With mistakes I mean that it will remove required classes. Think about the usage of reflection inside a library (and there are such usages). A static analyzer will not be able to know which classes are used. For further discussions about this topic, please start a new thread. Upvote 0
The full answer is that the compiler can strip unused classes but not without mistakes. With mistakes I mean that it will remove required classes. Think about the usage of reflection inside a library (and there are such usages). A static analyzer will not be able to know which classes are used. For further discussions about this topic, please start a new thread.
LucaMs Expert Licensed User Longtime User Feb 4, 2016 #9 lemonisdead said: Seems to be very costly since we can do it by hand Edit: sorry, what I mean is : the compiler should do this each compilation time // we do it one time when we create the app and can change it after to adapt Click to expand... I know, but we will spend more time than the compiler and we could make mistakes. If necessary, we could choose an "exclusionary compilation" only for the final release Upvote 0
lemonisdead said: Seems to be very costly since we can do it by hand Edit: sorry, what I mean is : the compiler should do this each compilation time // we do it one time when we create the app and can change it after to adapt Click to expand... I know, but we will spend more time than the compiler and we could make mistakes. If necessary, we could choose an "exclusionary compilation" only for the final release
LucaMs Expert Licensed User Longtime User Feb 4, 2016 #10 Erel said: The full answer is that the compiler can strip unused classes but not without mistakes. With mistakes I mean that it will remove required classes. Think about the usage of reflection inside a library (and there are such usages). A static analyzer will not be able to know which classes are used. For further discussions about this topic, please start a new thread. Click to expand... To understand this answer I need more time, and I'm running Thank you Upvote 0
Erel said: The full answer is that the compiler can strip unused classes but not without mistakes. With mistakes I mean that it will remove required classes. Think about the usage of reflection inside a library (and there are such usages). A static analyzer will not be able to know which classes are used. For further discussions about this topic, please start a new thread. Click to expand... To understand this answer I need more time, and I'm running Thank you
S sorex Expert Licensed User Longtime User Feb 4, 2016 #11 Excellent! I've been waiting for this for decades with other compilers that added too much unused stuff. Upvote 0
Excellent! I've been waiting for this for decades with other compilers that added too much unused stuff.
LucaMs Expert Licensed User Longtime User Feb 4, 2016 #12 Erel said: The full answer is that the compiler can strip unused classes but not without mistakes. With mistakes I mean that it will remove required classes. Think about the usage of reflection inside a library (and there are such usages). A static analyzer will not be able to know which classes are used. Click to expand... LucaMs said: To understand this answer I need more time, and I'm running Thank you Click to expand... I got it Upvote 0
Erel said: The full answer is that the compiler can strip unused classes but not without mistakes. With mistakes I mean that it will remove required classes. Think about the usage of reflection inside a library (and there are such usages). A static analyzer will not be able to know which classes are used. Click to expand... LucaMs said: To understand this answer I need more time, and I'm running Thank you Click to expand... I got it
Robert Valentino Well-Known Member Licensed User Longtime User Feb 4, 2016 #13 Will the new version offer SPACES instead of TABS? BobVal Upvote 0
Informatix Expert Licensed User Longtime User Feb 5, 2016 #14 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. Upvote 0
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.
Erel B4X founder Staff member Licensed User Longtime User Feb 5, 2016 #15 Robert Valentino said: Will the new version offer SPACES instead of TABS? Click to expand... It is better to start a new thread for such questions. The answer is no. Upvote 0
Robert Valentino said: Will the new version offer SPACES instead of TABS? Click to expand... It is better to start a new thread for such questions. The answer is no.
Erel B4X founder Staff member Licensed User Longtime User Feb 9, 2016 #16 Example of using CreateResource to set the native light theme on Android 4+: Code: Copy SetApplicationAttribute(android:theme, "@style/LightTheme") CreateResource(values-v20, theme.xml, <resources> <style name="LightTheme" parent="@android:style/Theme.Material.Light"> </style> </resources> ) CreateResource(values-v14, theme.xml, <resources> <style name="LightTheme" parent="@android:style/Theme.Holo.Light"> </style> </resources> ) Upvote 0
Example of using CreateResource to set the native light theme on Android 4+: Code: Copy SetApplicationAttribute(android:theme, "@style/LightTheme") CreateResource(values-v20, theme.xml, <resources> <style name="LightTheme" parent="@android:style/Theme.Material.Light"> </style> </resources> ) CreateResource(values-v14, theme.xml, <resources> <style name="LightTheme" parent="@android:style/Theme.Holo.Light"> </style> </resources> )
ArminKH Well-Known Member Feb 9, 2016 #17 Erel said: Example of using CreateResource to set the native light theme on Android 4+: Code: Copy SetApplicationAttribute(android:theme, "@style/LightTheme") CreateResource(values-v20, theme.xml, <resources> <style name="LightTheme" parent="@android:style/Theme.Material.Light"> </style> </resources> ) CreateResource(values-v14, theme.xml, <resources> <style name="LightTheme" parent="@android:style/Theme.Holo.Light"> </style> </resources> ) Click to expand... also can be used for animation xml files? Upvote 0
Erel said: Example of using CreateResource to set the native light theme on Android 4+: Code: Copy SetApplicationAttribute(android:theme, "@style/LightTheme") CreateResource(values-v20, theme.xml, <resources> <style name="LightTheme" parent="@android:style/Theme.Material.Light"> </style> </resources> ) CreateResource(values-v14, theme.xml, <resources> <style name="LightTheme" parent="@android:style/Theme.Holo.Light"> </style> </resources> ) Click to expand... also can be used for animation xml files?
Erel B4X founder Staff member Licensed User Longtime User Feb 9, 2016 #18 Yes, it can be used to create any text based resource file. Upvote 0
Guardian17 Active Member Licensed User Longtime User Feb 9, 2016 #19 For #ExcludeClasses, does there exist some list of all classes that can be excluded, so that I can examine the list and then determine what I can Exclude? Upvote 0
For #ExcludeClasses, does there exist some list of all classes that can be excluded, so that I can examine the list and then determine what I can Exclude?
Erel B4X founder Staff member Licensed User Longtime User Feb 10, 2016 #20 You can always open the jar file with a tool such as 7zip and see all the classes and packages. Specific to google plays services then the list I posted in the first post covers all the non-small packages. The only one missing is .maps. Upvote 0
You can always open the jar file with a tool such as 7zip and see all the classes and packages. Specific to google plays services then the list I posted in the first post covers all the non-small packages. The only one missing is .maps.