APK size decrease after gradle plugin update to version 3.6

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

APK size decrease after gradle plugin update to version 3.6

Sergey Petrovskiy
Good day!
Can someone explain me the reason of apk size decrease after gradle plugin update to version 3.6?
I use NDK and c++ src in my project. After update I realized that apk has smaller size (100mb vs 150mb). I explored APK and found that myapp.so (in lib/armeabi-v7a/ ) has size 10mb instead of 20mb. I revert plugin update and rebuild the app. myapp.so size went back to 20mb. I did read Release Notes but didn't find any reason. I read about android:extractNativeLibs parameter, it set explicitly to true in manifest.xml in both builds. But size still differs. So the only thing that I change is the plugin's version (from 3.5.4 to 3.6.0). 
APK size reduction is okay for me, but I am very interested how it happens and why.

Any help is appreciated
Thanks

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/49b0964c-b813-4948-bfa1-c5d5b7bf8854n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: APK size decrease after gradle plugin update to version 3.6

Yury Habets
Hey!

extractNativeLibs should affect the size of the APK, but not the size of the .so itself in the APK.
I guess the NDK version is the same in both cases, isn't it?

I can't tell you the exact reason on what's happening, but you could check on your own using objdump and checking if there's some obvious difference, like - missing section (debug info? symbols?).

Cheers
Yury

On Saturday, October 17, 2020 at 12:28:03 AM UTC+2 [hidden email] wrote:
Good day!
Can someone explain me the reason of apk size decrease after gradle plugin update to version 3.6?
I use NDK and c++ src in my project. After update I realized that apk has smaller size (100mb vs 150mb). I explored APK and found that myapp.so (in lib/armeabi-v7a/ ) has size 10mb instead of 20mb. I revert plugin update and rebuild the app. myapp.so size went back to 20mb. I did read Release Notes but didn't find any reason. I read about android:extractNativeLibs parameter, it set explicitly to true in manifest.xml in both builds. But size still differs. So the only thing that I change is the plugin's version (from 3.5.4 to 3.6.0). 
APK size reduction is okay for me, but I am very interested how it happens and why.

Any help is appreciated
Thanks

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/34bbd02b-0ea1-41b0-a5f4-56ac35d46ba4n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: APK size decrease after gradle plugin update to version 3.6

Alex Cohn
In reply to this post by Sergey Petrovskiy
Most likely, your shared object is called libmyapp.so. This "lib" prefix is essential for the package manager to locate and install your libraries correctly.

Anyways, the change of file size after upgrading the AGP may be attributed to the build stage when the native libraries are stripped (removing some debug information), which could easily account for a 50% decrease. This strip is performed by the NDK, which must be installed on the build machine even if the APK uses prebuilt libraries. Also, each version of AGP expects a specific version of NDK, and if there is no match, the strip step may be simply skipped. 

BR,
Alex
On Saturday, October 17, 2020 at 1:28:03 AM UTC+3 [hidden email] wrote:
Good day!
Can someone explain me the reason of apk size decrease after gradle plugin update to version 3.6?
I use NDK and c++ src in my project. After update I realized that apk has smaller size (100mb vs 150mb). I explored APK and found that myapp.so (in lib/armeabi-v7a/ ) has size 10mb instead of 20mb. I revert plugin update and rebuild the app. myapp.so size went back to 20mb. I did read Release Notes but didn't find any reason. I read about android:extractNativeLibs parameter, it set explicitly to true in manifest.xml in both builds. But size still differs. So the only thing that I change is the plugin's version (from 3.5.4 to 3.6.0). 
APK size reduction is okay for me, but I am very interested how it happens and why.

Any help is appreciated
Thanks

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/e165ec8b-14e4-4dff-98f7-8ca73da19af7n%40googlegroups.com.