调试与发布版本在Android NDK [英] Debug vs. Release builds in the Android NDK

查看:220
本文介绍了调试与发布版本在Android NDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作,必须移植到Android的大型游戏引擎。所有code是C / C ++,所以我们通过NDK移植。我已经得到了一切的建筑,但很多冲刷后,我仍然不明朗,最好的方法是建立调试与我们.so文件的发布版本。改变事物的手,每次是老了。

你有不同的Application.mk文件为每个目标?或者是有一些办法,包括多个目标的JNI /目录下的一个Android.mk文件?或许第三种选择可能是编写一个标准的makefile文件,设置环境变量的Andr​​oid.mk文件使用,告知构建过程?

最后,关于Android的最后一个问题:调试的标志,必须在AndroidManifest.xml文件中设置。这是什么实际上有上被复制到设备所产生的本地code有什么影响?

最好的和感谢,

凯文

解决方案
  

你有不同的Application.mk文件为每个目标?

没有。单独的子目录,都用自己的Andr​​oid.mk(共享和静态库),但只有一个Application.mk我。

我Application.mk就是:

  APP_STL:= gnustl_static
APP_OPTIM:=调试
 

  

我还是个未知数,最好的方法是建立调试与我们.so文件的发布版本。改变事物的手,每次是老了。

这是一个位S $ P $垫出来,至少对我来说,使用JNI / Android.mk + Application.mk布局。

Application.mk具有 APP_OPTIM:=调试 然后在AndroidManifest.xml中的应用元素我有机器人:可调试=真正的 当你用NDK建造,它采用这种明显​​标志来确定优化(这是非常有用的关闭或打开,关闭剖析,等等。)

(有点偏离主题)我最近跑了对面

<一个href="https://$c$c.google.com/p/android-ndk-profiler/">https://$c$c.google.com/p/android-ndk-profiler/

,当与<组合href="http://$c$c.google.com/p/jrfonseca/wiki/Gprof2Dot">http://$c$c.google.com/p/jrfonseca/wiki/Gprof2Dot

生成一些pretty的图像,以帮助的事情是如何在手机本身上运行了我的一点心意把握。

I'm working on a large game engine that must be ported to Android. All the code is C/C++, so we are porting via the NDK. I've got everything building, but after lots of scouring, I'm still uncertain what the best method is for building Debug vs. Release versions of our .so file. Changing things by hand every time is getting old.

Do you have different Application.mk files for each target? Or is there some way to include multiple targets in a single Android.mk file under the jni/ directory? Or perhaps a third option might be to write a standard makefile that sets environment variables that the Android.mk file uses to inform the build process?

Finally, one last question regarding the android:debuggable flag that must be set in the AndroidManifest.xml file. What this actually have any effect on the generated native code that's copied to the device?

Best and thanks,

Kevin

解决方案

Do you have different Application.mk files for each target?

No. Separate subdirectories, all with their own Android.mk (shared and static libs) but only one Application.mk for me.

My Application.mk is just:

APP_STL := gnustl_static
APP_OPTIM := debug

I'm still uncertain what the best method is for building Debug vs. Release versions of our .so file. Changing things by hand every time is getting old.

It's a bit spread out, for me at least, using the jni/Android.mk + Application.mk layout.

Application.mk has APP_OPTIM := debug Then in the application element of AndroidManifest.xml I have android:debuggable="true" When you build with ndk-build, it uses this manifest flag to determine optimization (which is useful to turn off or on, off for profiling, etc.)

(A Little Off topic) I recently ran across

https://code.google.com/p/android-ndk-profiler/

Which, when combined with http://code.google.com/p/jrfonseca/wiki/Gprof2Dot

Generates some pretty images to help my little mind grasp how things are running over on the phone itself.

这篇关于调试与发布版本在Android NDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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