简体   繁体   English

Titanium Android模块应使用哪个版本的NDK?

[英]Which version of NDK should I use with a Titanium Android module?

According to the source and wiki , Titanium requires r9 of the Android NDK. 根据消息来源Wiki ,Titanium需要Android NDK的r9。 But in the Android archives , the oldest version available is r10e (May 2015). 但在Android档案中 ,可用的最旧版本是r10e(2015年5月)。 The current version is r14b. 当前版本是r14b。

With r14b (and r13b) I get compilation failures from ndk-build involving a C++ type mismatch. 使用r14b(和r13b)时,我从ndk-build遇到涉及C ++类型不匹配的编译失败。

[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]

I can compile a module cleanly using r10e, r11c and r12b, but I'm hesitant to release something with an unsupported NDK version. 我可以使用r10e,r11c和r12b干净地编译模块,但是我犹豫要发布不受支持的NDK版本的东西。 It seems strange that Titanium requires a version of NDK from 2014 as well. Titanium也需要2014年以后的NDK版本,这似乎很奇怪。 I'm not sure which version to use. 我不确定要使用哪个版本。

As of today, the same wiki page speaks of NDK r12, which can be downloaded from the official archive . 截至今天,同一Wiki页面谈到了NDK r12,可以从官方档案库中下载。 The drawbacks of using an older NDK are, outweighed by the risks of relying on tiny nuances of compiler compatibility. 使用较老的NDK的缺点被依赖于编译器兼容性的细微差别的风险所抵消。 It would require exhaustive testing on a wide range of supported devices to prove that your build with NDK r16 is OK. 它将需要在各种受支持的设备上进行详尽的测试,以证明您使用NDK r16进行的构建是可以的。 And note that upgrading NDK requires some fixes, see https://github.com/appcelerator/titanium_mobile/pull/9926 . 请注意,升级NDK需要一些修复程序,请参阅https://github.com/appcelerator/titanium_mobile/pull/9926

As long as you don't need the native APIs that are specific for Oreo and higher, you can use r12 without fear. 只要您不需要特定于Oreo和更高版本的本机API,就可以使用r12而不用担心。

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. 如果您的项目涉及无法使用NDK r12构建的其他NDK组件,请记住,可以在一个应用程序中混合使用单独构建的共享库(具有不同的NDK版本),只要它们之间不共享C ++对象即可。 Titanium v8 framework is safe is this sense. Titanium v​​8框架是安全的,这就是意义。

One point of weakness here is the shared STL runtime libc++_shared.so . 这里的弱点之一是共享的STL运行时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 对于这种情况,可能最安全的解决方案是更改Titanium Application.mk文件以使用

APP_STL := c++_static

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM