我知道这不是您列出的选项之一,但不会自动排除 C++。例如,这就是 Dropbox 使用的方法,他们甚至为此目的开源了他们的工具:
C++ 到 Java/Objective-C API 生成器:
https://github.com/dropbox/djinni https://github.com/dropbox/djinni
适用于 Android/iOS 的示例“本机”应用程序:
https://github.com/libmx3/mx3 https://github.com/libmx3/mx3
关于该主题的有趣文章有更多链接:
http://oleb.net/blog/2014/05/how-dropbox-uses-cplusplus-cross-platform-development/ http://oleb.net/blog/2014/05/how-dropbox-uses-cplusplus-cross-platform-development/
更新答案:
如果您确实不想使用 C++ 并且可以接受非本地语言带来的臃肿,那么您可以尝试以下操作:
https://github.com/MobileChromeApps/mobile-chrome-apps https://github.com/MobileChromeApps/mobile-chrome-apps
该项目是 Google 的 Cordova 分支,并添加了许多新功能和优点。
这里有一个针对 Chrome API 的 Dart 包装器:
https://github.com/dart-gde/chrome.dart https://github.com/dart-gde/chrome.dart
基本上,您可以使用纯 HTML5 技术在 Dart 中编写应用程序,然后对于某些事情您可以使用 Chrome API(设备状态等)。然后您可以部署:
- Web:编译为 JavaScript,无需 Chrome API 功能。
- Chrome 操作系统:使用 Chrome API 功能编译为 JavaScript。
- Android:编译为 JavaScript,然后使用 MobileChromeApps 创建 Android 应用程序。
- iOS:编译为 JavaScript,然后使用 MobileChromeApps 创建 iOS 应用程序。