NDK编译debug和release

昨晚编译NfcGuestKey的so文件的时候,发现新的so文件会导致APP崩溃,原来的确没有问题,比较了一下,大小区别很大,原来的30kb,新编译的60kb,而且原来的没有gdb.setup和gdbserver。

CheckOut原来的版本,用一样的代码,却发现还是30kb,仔细比较,发现30kb的版本没有obj\local\armeabi\objs-debug,也没有gdb.setup和gdbserver,莫非是NDK编译也存在debug和release版本的区别?

百度了NDK编译release,查找到如下文章:

Android NDK 设置编译模式debug和release

Unless you have created the Application.mk or defined your application as debuggable inside the AndroidManifest.xml you don't have to do anything because by default the application's modules are compiled in release mode by the ndk-build script.

Otherwise, you can use the APP_OPTIM directive inside the Application.mk file:
APP_OPTIM:=release
APP_PLATFORM:=android-14
APP_STL:=gnustl_static
APP_ABI:= armeabi armeabi-v7a

也就是NDK默认是编译release版本,除非AndroidManifest.xml设置了debuggable标志为true或者Application.mk中设置了APP_OPTIM,查看生成60kb so文件的两个工程,

果然android:debuggable="true",修改为android:debuggable="false"后,

重新
$NDK/ndk-build clean
$NDK/ndk-build
大小为30kb,不再生成obj\local\armeabi\objs-debug,gdb.setup和gdbserver。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值