Titanium Android模块应使用哪个版本的NDK? [英] Which version of NDK should I use with a Titanium Android module?

查看:103
本文介绍了Titanium Android模块应使用哪个版本的NDK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 wiki ,Titanium需要Android NDK的r9.但是在 Android档案中,可用的最旧版本是r10e(2015年5月) .当前版本是r14b.

According to the source and wiki, Titanium requires r9 of the Android NDK. But in the Android archives, the oldest version available is r10e (May 2015). The current version is r14b.

使用r14b(和r13b)时,我从ndk-build中遇到涉及C ++类型不匹配的编译失败.

With r14b (and r13b) I get compilation failures from ndk-build involving a C++ type mismatch.

[ERROR] /Users/jdee/Library/Application Support/Titanium/mobilesdk/osx/6.1.0.GA/android/native/include/AndroidUtil.h:57:49: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]

[ERROR] /Users/jdee/Library/Application Support/Titanium/mobilesdk/osx/6.1.0.GA/android/native/include/AndroidUtil.h:57:49: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]

我可以使用r10e,r11c和r12b干净地编译模块,但是我犹豫要发布不受支持的NDK版本的东西. Titanium也需要从2014年开始的NDK版本,这似乎很奇怪.我不确定要使用哪个版本.

I can compile a module cleanly using r10e, r11c and r12b, but I'm hesitant to release something with an unsupported NDK version. It seems strange that Titanium requires a version of NDK from 2014 as well. I'm not sure which version to use.

推荐答案

到今天为止,相同的维基页面提到了NDK r12,可以从 https://github.com/appcelerator/titanium_mobile/拉/9926 .

As of today, the same wiki page speaks of NDK r12, which can be downloaded from the official archive. The drawbacks of using an older NDK are, outweighed by the risks of relying on tiny nuances of compiler compatibility. It would require exhaustive testing on a wide range of supported devices to prove that your build with NDK r16 is OK. And note that upgrading NDK requires some fixes, see https://github.com/appcelerator/titanium_mobile/pull/9926.

只要不需要特定于Oreo和更高版本的本机API,就可以使用r12,而不必担心.

As long as you don't need the native APIs that are specific for Oreo and higher, you can use r12 without fear.

如果您的项目涉及其他不能使用NDK r12构建的NDK组件,请记住,您可以在一个应用程序中混合使用单独构建的共享库(具有不同的NDK版本),只要它们之间不共享C ++对象即可.钛v8框架是安全的.

If your project involves other NDK components that cannot be built with NDK r12, please remember that you can mix shared libraries built separately (with different NDK versions) in one app, as long as they do not share C++ objects between them. Titanium v8 framework is safe is this sense.

这里的一个弱点是共享STL运行时 libc ++ _ shared.so .您的应用程序中不能有两个不同的版本.对于这种情况,可能最安全的解决方案是更改Titanium

One point of weakness here is the shared STL runtime libc++_shared.so. You cannot have two different versions of it in your app. Probably the safest solution for such situation is to change the Titanium Application.mk file to use

APP_STL := c++_static

这篇关于Titanium Android模块应使用哪个版本的NDK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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