android 升级AGP版本后部分so文件变大
排查问题
bash 查看so是否携带符号表
readelf -s libxxx.so | less
例如:输出中包含
Section 名 | 大小(十六进制) | 大小(约) |
---|---|---|
.debug_line | 0x2f23946 | ~47 MB |
.debug_info | 0x26c523e | ~39 MB |
.debug_loc | 0x2022c91 | ~33 MB |
.debug_ranges | 0x835a10 | ~8 MB |
可以看出符号表没有被剥离
正常情况下,android编译的时候gradle会自动剥离符号表,如果出现日志:
15:25:40 > Task :app:stripReleaseDebugSymbols 15:25:40 Unable to strip the following libraries, packaging them as they are: 体积变大的.so,
大概率是NDK版本不兼容,升级NDK后一般可以解决