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


当前回答

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

其他回答

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

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

这篇博客文章可能是一个好的开始:http://benno.id.au/blog/2007/11/13/android-native-apps 不幸的是,很多重要的东西都“留给读者做练习”。

您可以下载c4droid,然后安装GCC插件并安装到SD上。从shell,我只是遍历到GCC二进制文件所在的目录,然后调用它,使其成为板上可执行文件。

查找/ -name GCC

/mnt/sdcard/Android/data/com.n0n3m4.droidc/files/gcc/bin/arm-linux-androideabi-gcc

猫>测试

#include<stdio.h>
int main(){ 
 printf("hello arm!\n");
return 0;
}

./arm-linux-androideabi-gcc test.c -o test

/测试。

你好手臂!

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

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

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