-
I couldn't find the right answer anywhere. please lead me on the way... https://github.com/google-home/sample-app-for-matter-android One is a mac(m1), the other is an intel CPU PC. I struggled a bit at first, but I found the clue. The above NDK version, 23.1.7779620, was installed on the Mac, Due to this difference, the size of the .so file packaged in the apk was such a difference. As far as I know, there is no need to install NDK when building a prebuilt .so file as an apk. When packaging the .so file in the android project, should the NDK version suitable for the so file be installed? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
if you run strip on the large file, does it end up the same size as the
small file? strip is in the ndk, so if you don't have that installed, maybe
your build skips that step?
…On Mon, Feb 20, 2023, 23:20 ciwhiz ***@***.***> wrote:
I couldn't find the right answer anywhere. please lead me on the way...
https://github.com/google-home/sample-app-for-matter-android
I built this project on two different PCs.
One is a mac(m1), the other is an intel CPU PC.
Among the .so files included in the sample app project above, the largest
file, libCHIPController.so, is about 340MB.
When this .so file is built as a release APK on each PC,
When I opened the apk,
On the mac it was reduced to about 25 MB, while on the intel it stayed the
same at 340 MB.
I struggled a bit at first, but I found the clue.
There is no difference between the CPU of the build PC.
The cause is that the above project is built with AGP (android gradle
plugin), and AGP has a basic NDK version for each version.
The AGP of the above project is 7.4 and the default NDK version is
23.1.7779620.
The above NDK version, 23.1.7779620, was installed on the Mac,
NDK 21.4.xx, 25.2.xxx were installed on the Intel PC.
Due to this difference, the size of the .so file packaged in the apk was
such a difference.
As far as I know, there is no need to install NDK when building a prebuilt
.so file as an apk.
In fact, the build itself doesn't fail. However, there is only a
difference in the size of the .so file.
When packaging the .so file in the android project, should the NDK version
suitable for the so file be installed?
Has anyone seen a guide or document about this? am i missing something?
—
Reply to this email directly, view it on GitHub
<#1844>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMVLEWEAOP7SAGMPTTW5YRDWYRUDZANCNFSM6AAAAAAVCVNPA4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
There is if you want AGP to strip those libraries. I (unsuccessfully) argued against this behavior, FWIW. A real user might have more luck getting it changed than I did. You'd need to file an AGP bug. I expect the only way this can have the behavior that users want (if I've understood correctly, "leave me alone and strip the damn libraries") is for build-tools to bundle |
Beta Was this translation helpful? Give feedback.
-
@enh-google , @DanAlbert , |
Beta Was this translation helpful? Give feedback.
There is if you want AGP to strip those libraries.
llvm-strip
is shipped in the NDK. If you have no NDK installed AGP cannot strip prebuilt libraries during APK packaging. If you read the warnings from your AGP build you should see this: https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:build-system/gradle-core/src/main/java/com/android/build/gradle/internal/cxx/stripping/SymbolStripExecutableFinder.kt;l=54-58;drc=58c237e7f2a2cbb89b1011a384d63a5f64195845I (unsuccessfully) argued against this behavior, FWIW. A real user might have more luck getting it changed …