如何避免剥离 Android 应用程序的本机代码符号 [英] How to avoid stripping for native code symbols for android app

查看:19
本文介绍了如何避免剥离 Android 应用程序的本机代码符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本机代码中得到 sigsegv 11,我需要避免剥离以了解问题所在.该应用程序使用库(aar),我能够避免使用 'cmd-strip' 破解.但是在 .so 的 apk 剥离版本中,无论如何都会使用该应用程序剥离符号,可能是在 transformNative_libsWithStripDebugSymbolForDebug gradle 任务时.有什么改变可以避免吗?

I'm getting sigsegv 11 in native code and i need to avoid stripping to understand what's wrong. The app uses library (aar) and i was able to avoid stripping for the aar with 'cmd-strip' hack. But in the apk stripped version of .so is used anyway so the app strips the symbols, probably while transformNative_libsWithStripDebugSymbolForDebug gradle task. Any change to avoid it?

PS.在 SO 上找到 类似问题它有点不同(在我的例子中使用 aar 没有剥离的符号).

PS. Found similar question on SO but it's a bit different (using aar here with not stripped symbols in my case).

推荐答案

packagingOptions 中有一个未记录的方法 'doNotStrip',只需在 build.gradle 中添加以下行

There's an undocumented method 'doNotStrip' in packagingOptions, just add following lines in your build.gradle

packagingOptions{
    doNotStrip "*/armeabi/*.so"
    doNotStrip "*/armeabi-v7a/*.so"
    doNotStrip "*/x86/*.so"
}

这篇关于如何避免剥离 Android 应用程序的本机代码符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆