You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
@ljbade No, it doesn't fix the problem. Proguard is already setup in the sample test app. Its just disabled. Changing minifyEnabled from false to true in build.gradle makes it run. However the build fails with tons of warnings. Proguard optimizes and minimizes apk size at bytecode level. So new rules would need to be added for the Mapbox SDK. It should easily knock off a couple of megs from the final apk. Once the proguard configuration file for Mapbox SDK is ready, it could be bundled into AAR project as @tobrunvannuland suggest (I haven't tried it though).
Thanks @tobrunvannuland , it will be very useful for Android. The APK file size limit is only 50MB for Android (half that of iOS). Since we build a fat apk that contains native libs of all supported platforms, the proguard optimization to reduce apk size will be very helpful.
I have this setup working for the SNAPSHOT, while having the test app use following proguard config:
-keep class com.mapbox.mapboxgl.annotations.* { ; }
-keep class com.mapbox.mapboxgl.geometry.* { ; }
-keep class com.mapbox.mapboxgl.http.* { ; }
-keep class com.mapbox.mapboxgl.views.MapView
-keep class com.mapbox.mapboxgl.views.NativeMapView**
-keepclassmembers class com.mapbox.mapboxgl.views.NativeMapView** {;}
-dontwarn okio.*
Things to do:
Move config file to library project
Test release build while building from source
Optimise configuration further
Current result:
apk size size was reduced from 13.8 MB to 13.2 MB
Reason behind the limited result:
Proguard only works with java bytecode and the amount of java code is currently limited.
FYI: I took a look at the unzipped version of the apk and I noticed following:
total size is 37.5 MB
lib folder size with native libs is 34.4 MB.
This means that >90% of an obfuscated apk size is used up by the native libs
Activity
tobrun commentedon Aug 21, 2015
To support proguard in an AAR project, following should be added to the build.gradle
This file will be packaged in the AAR and will be automatically applied in the main application project.
ljbade commentedon Aug 25, 2015
@mb12 Does @tobrunvannuland suggestion fix the problem?
mb12 commentedon Aug 25, 2015
@ljbade No, it doesn't fix the problem. Proguard is already setup in the sample test app. Its just disabled. Changing minifyEnabled from false to true in build.gradle makes it run. However the build fails with tons of warnings. Proguard optimizes and minimizes apk size at bytecode level. So new rules would need to be added for the Mapbox SDK. It should easily knock off a couple of megs from the final apk. Once the proguard configuration file for Mapbox SDK is ready, it could be bundled into AAR project as @tobrunvannuland suggest (I haven't tried it though).
tobrun commentedon Aug 25, 2015
Will do some tests in next couple days, will produce some proguard configs along the way.
mb12 commentedon Aug 25, 2015
Thanks @tobrunvannuland , it will be very useful for Android. The APK file size limit is only 50MB for Android (half that of iOS). Since we build a fat apk that contains native libs of all supported platforms, the proguard optimization to reduce apk size will be very helpful.
tobrun commentedon Aug 28, 2015
I have this setup working for the SNAPSHOT, while having the test app use following proguard config:
Things to do:
Current result:
Reason behind the limited result:
FYI: I took a look at the unzipped version of the apk and I noticed following:
This means that >90% of an obfuscated apk size is used up by the native libs
tobrun commentedon Aug 30, 2015
Implemented in PR
ljbade commentedon Aug 31, 2015
@tobrunvannuland Yeah we still working on reducing the native libs size, mostly by replace bits of dependencies with Java implementations: #2037
bleege commentedon Aug 31, 2015
I'll look at merging #2206. Thanks @tobrunvannuland!
bleege commentedon Aug 31, 2015
Tested and merged #2206. Thanks again @tobrunvannuland!