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


当前回答

谷歌刚刚发布了NDK。

http://feedproxy.google.com/~r/blogspot/hsDu/~3/2foWz7hwFtE/introducing-android-15-ndk-release-1.html

可以在这里找到: http://developer.android.com/sdk/ndk/1.5_r1/index.html

其他回答

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

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."

对于任何通过谷歌来了解这一点的人,请注意,从SDK 1.6开始,Android现在有一个官方的原生SDK。

你可以从这里下载Android NDK (Native Development Kit): https://developer.android.com/ndk/downloads/index.html

还有一篇关于NDK的博文: http://android-developers.blogspot.com/2009/06/introducing-android-15-ndk-release-1.html

谷歌已经在http://www.youtube.com/watch?v=5yorhsSPFG4上发布了谷歌I/O 2011:将C和c++游戏引入Android会议

这有助于理解NDK在c和c++中编写应用程序的使用。

如果你只是想交叉编译任何基于主机的原生游戏,并在android上运行它们,那么本文将展示3种方法。

1:使用独立工具链的静态编译

2:使用Android NDK的工具链进行交叉编译

3:交叉编译使用AOSP源代码

看看谷歌ndk组,它看起来很有前途,ndk的第一个版本将在2009年上半年发布。

更新: 它发布于http://android-developers.blogspot.com/2009/06/introducing-android-15-ndk-release-1.html

谷歌刚刚发布了NDK。

http://feedproxy.google.com/~r/blogspot/hsDu/~3/2foWz7hwFtE/introducing-android-15-ndk-release-1.html

可以在这里找到: http://developer.android.com/sdk/ndk/1.5_r1/index.html