我尝试着将一款游戏移植到Android上,但它是基于C语言,而Android也支持Java,但我相信一定有一种方法能够将C应用带到Android上,有人知道如何实现这一目标吗?


当前回答

通常情况下,你必须:

安装谷歌Android NDK。它 包含库,头文件,makfile 示例和GCC工具链 从您的C代码构建一个可执行文件 对于ARM,优化和链接它 如果需要,提供了库 使用提供的连接到电话 Adb接口和测试您的 可执行的

如果你想要销售一款应用:

用你的C代码构建一个库 创建简单的Java代码 使用这个库 将这个库嵌入应用程序 包文件 测试你的应用 免费出售或分发

其他回答

从这一点来看,似乎是有可能的:

http://openhandsetmagazine.com/2007/11/running-c-native-applications-on-android-the-final-point/(现在只能通过WayBack Machine购买)

"the fact is only Java language is supported doesn’t mean that you cannot develop applications in other languages. This have been proved by many developers, hackers and experts in application development for mobile. The guys at Elements Interactive B.V., the company behind Edgelib library, succeeded to run native C++ applications on the Android platform, even that at this time there is still many issues on display and sound … etc. This include the S-Tris2 game and a 3D animation demo of Edgelib."

这三个步骤是很好的,并储存在这篇文章。

1)如何将原生c代码移植到android上

2) http://www.integratingstuff.com/2010/12/12/calling-native-c-code-through-jni-in-android-applications/

3) http://mindtherobot.com/blog/452/android-beginners-ndk-setup-step-by-step/

有一个计划,允许C/ c++库在Android的下一个SDK版本(代号Eclair?)到目前为止,这还不能通过Android Java SDK实现。但是,您可以获取HUGE开源项目,滚动您自己的库,然后刷新您自己的设备……但是任何想要使用你的库的人都必须同时刷新你的自定义构建。

也许你在找这个?

http://www.mosync.com/

它是使用c++为多个移动平台开发的中间层。

自2009年以来,这一问题有了进展。 用于Android的Qt(c++框架) 视频开始。