Inclusion of Sinch Library in Existing Android App , increases size of final apk. We found it is the .so file that are very large and contributing to increased size of apk. Please provide a way if some one knows through which size of .so can be reduced and then it can be used in Android Application, As a result final apk size would be reduced.
Thanks
all code we have in there needs to be in there. The only think you could do is to makes sliced builds for each Architecture
Inclusion of Sinch Library in Existing Android App , increases size of final apk.
No surprise. All libs you include in your project becomes part of your project (statically linked).
Related
I'm building an APK (not app bundle) using Gradle via Android Studio.
Without adding any Mozilla dependencies in my app's build.gradle file the APK size is under 5MB but after adding these dependencies the APK size increases to over 100MB.
Most of the APK size is in the (new) lib directory, particularly the lib/libxul.so file, but also the assets/omni.ja file is around 9MB.
I am aware of how to reduce the APK size by using ABI filters and APK splitting to generate separate APKs for different architectures, but this can only do so much to reduce the download size for the user. Is there any way I can significantly reduce the size of my APK? Are there any command line options I can add or additional Gradle options to achieve this?
For reference, I am importing the following dependencies: https://github.com/mozilla-mobile/android-components
from here: https://maven.mozilla.org/maven2
The official recommendation is here: https://developer.android.com/studio/build/shrink-code.
And you can also use Play feature delivery to serve some features only when needed by users: https://developer.android.com/guide/app-bundle/play-feature-delivery
I faced the task of reducing the size of .apk file of my android app. My apk size is more then 100MB now and tentatively it will grow. So I consider android app bundle as a temporary solution. .so libraries take the most space in apk and I'd like to take them off to expansion files if it is possible. Does anybody have such experience, and what can you advice to learn to solve this problem?
Reduce the size of your app by moving '.so' files to over-the-air. Follow this link
But this violates the Google Policy
You should:
Remove unused resources(image, layout, lib/dependency)
Turn on shirk resource on build.gradle
Moving something to OTA
Build the App bundle instead of APK
Is there a workaround to this, as the size of the apk is drastically increased and the library was added through normal procedure -
(compile 'com.github.wseemann:FFmpegMediaPlayer:1.0.4')
and not through manual inclusion or downloading I wonder whether anyone else has this problem.
if you go to the source code of the library, to the releases page (https://github.com/wseemann/FFmpegMediaPlayer/releases) you'll see that you can manually download to your PC, what is normally being downloaded by gradle and then added to your APK.
There you can see it's 50mb zip, file so it's not crazy to imagine 35mb increase in the APK.
That's because it's not a half dozen Java files, like most libraries are, but this have the compiled binary code of the FFMPEG, compiled for each platform Android uses (arm, x86, 32 and 64bits).
So yeah, final conclusion, if you're really gonna use any ffmpeg based thing, your app will take this extra space.
We have several dependency libraries in our APK and have enabled proguard and multi dex. We have 3 dex files. We intend to keep the APK size as small as possible.
We are currently trying to integrate a 'new Ads SDK'.
While integrating, we are seeing an abnormal increase in the size of our APK after including the dependency library.
The memory footprint of the library is around ~280 KB in a sample app. But when we add the same dependency in our app, our apk size increases by 595 KB. Their proguard rule keeps all their classes.
On debugging with APK analyzer in android studio and classyshark, we observed that the size of other packages and classes like facebook, google, glide etc in our dex files are increasing in size.
However, their method counts remain same. This could only mean the proguard compression is being compromised. So, APK size increase is like 280 KB (ads sdk) + X [315 KB]. We are trying to eliminate the unnecessary 315 KB increase in the APK size.
Any leads on investing the cause of this abnormal increase in size would be appreciated.
Please share any dex options/proguard optimizations which might help in this scenario.
UPDATE:
The proguard rules of the SDK in question looks like this:
-keep class com.example.** { *; }
-dontwarn com.example.**
Thank you.
What i can infer from your post is most likely some of the rules added in proguard as part of new lib config causes decrease in code shrink for lib like facebook , google. It is difficult to avoid 3rd party sdk rules, however you can still shrink your apk using other approach if that is not yet adopted by your app. If your graphic resources still use PNG change them to webP it would reduce the size of apk.
Also check for common lib if present as part of ads sdk. Once we had seen two version of google play services in our app and we had to exclude the one present in sdk dependency via gradle config.
I Build an APK using Android studio and its bigger than I expected. I attached a APK analyze report and it shows lib download file size is 56.6 MB. can anyone suggest a way how can i reduce that lib size.
PS: And can someone explain me what is this lib means? becouse i did't use any libs other than dependency. and as i know those dependency included in classes.dex
Thanks.
Screen shot of the APK analyze :
Since you have the dependency of vlc-android-sdk library which contains large native library (libvlc.so) and is included in the app, your apk size is large.
You can use splits or product flavors for different CPU architectures to include only necessary so files. Or you should use a different library.