Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: reduce app size by removing mapbox #1516

Merged
merged 3 commits into from
Apr 3, 2019
Merged

chore: reduce app size by removing mapbox #1516

merged 3 commits into from
Apr 3, 2019

Conversation

anhanh11001
Copy link
Contributor

@anhanh11001 anhanh11001 commented Apr 3, 2019

Fixes #1515

Changes:

  • Reduce image size
  • Android Lint to improve some Koitline code, remove unused imports
  • enable shrinkResource
  • Set resConfig to "en" as other translation is not fully supported now
  • Remove Mapbox from the app, so location autosuggestion is replaced by the old layout with searchView

Currently, the APK size is 7.8MB and the download size is 7.2 MB. One more thing I find is that Proguard is not customized for the project and it still keeps everything so it doesn't help to reduce the app size - if I comment the Proguard line in the app Gradle file, it doesn't change the app size (hope that I understand this correctly). I'll take a closer look at this more on tomorrow

Details:
- Reduce image size
- Android Lint to improve some Koitline code, remove unused imports
- enable shrinkResource
- Set resConfig to "en" as other translation is not fully supported now
@iamareebjamal
Copy link
Member

Proguard is working.

Without proguard - 18.8 MB
With proguard - 14.1 MB

After removing mapbox and jackson-kotlin-module with proguard - 4.7 MB

val MAP_LOCATION = "${event.latitude},${event.longitude}"
val MAP_SETTINGS = "&zoom=15&size=320x200&sensor=false"
val MAP_KEY = "&key = $GOOGLE_MAP_KEY"
return MAP_BASE_URL + MAP_LOCATION + MAP_SETTINGS + MAP_KEY
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could remain as MapBox is better for free projects

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have returned it back to Mapbox

@@ -56,11 +55,37 @@ class SearchLocationFragment : Fragment() {
redirectToMain()
})

setupPlaceAutoCompleteFrag(savedInstanceState)
rootView.locationSearchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What'll happen here?

Copy link
Contributor Author

@anhanh11001 anhanh11001 Apr 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In short, I reverted it back to old SearchLocationFragment where there is only a searchview for user to type in the name of the the place, there isn't location suggestion anymore (I will improve this fragment with retaining old search and hopefully a better autosuggestion solution if this PR is accepted). Here is the view:

@@ -1,28 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
<RelativeLayout
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reverted it

Details:
Completely remove mapbox and replace current autosuggestion location search view with old search view
app/build.gradle Outdated
@@ -22,6 +22,7 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
resConfigs "en"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert

@iamareebjamal iamareebjamal changed the title fix: 1515 reduce app size chore: reduce app size by removing mapbox Apr 3, 2019
@iamareebjamal iamareebjamal added chore and removed fix labels Apr 3, 2019
@iamareebjamal iamareebjamal merged commit 4a243a5 into fossasia:development Apr 3, 2019
@anhanh11001 anhanh11001 deleted the 1515_reduce_app_size branch June 20, 2019 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tremendous increase in app size
2 participants