cocos2dx linux and android project in eclipse
2011-09-03 11:47
417 查看
like what cocos2dx do, I wrote a script to build android project as well. but the difference is linux project will be built at the same time, and it apply standalone toolchain to compile directly in eclipse 3.7. Currently,
the script is named mycreate-android-project.sh in the base folder of cocos2dx. and before you read this, you had better read my first and second blog about cocos2dx for linux...
the step is like this for the first time to build the project.
1. build android ndk standalone environment, you reference my last blog here or get the guide from
http://www.srombauts.fr/android-ndk-r5b/docs/STANDALONE-TOOLCHAIN.html
2. As a project template Helloworld, you should set cocos2dx_loc first in preference->c/c++ build->build variables. cocos2dx_loc is the path to your cocos2dx base folder.
![](https://oscdn.geek-share.com/Uploads/Images/Content/202002/13/c7cc15f677a3c81c1cdada93fb2c9dce.gif)
3. Change some macros in mycreate-android-project.sh to work in your environment.
NDK_ROOT="/home/laschweinski/android/android-ndk-r5"
the root of ndk
ANDROID_SDK_ROOT="/home/laschweinski/android/android-sdk-linux_86"
The root of android sdk
COCOS2DX_ROOT="/home/laschweinski/git/cocos2d-x"
the root of cocos2dx
then to build the project, simple command is like this:
laschweinski@laschweinski-laptop:~/Documents/workspace$ sh ~/git/cocos2d-x/mycreate-android-project.sh
(you could create the project wherever you want)
4. import projects, and test in eclipse 3.7
import the project where you run the command (in this case,~/Documents/workspace/[your
project name]/linux) in your eclipse
besides, the project has 4 target, Debug and Release is for linux, and AndroidDebug, AndroidRelease is for android, default compiled to be a shared lib for ndk. after
compiling the project, the libs will be copied to android/libs/armeabi. (due to a shell named postCompile.sh executed after compiled automatically, and I configure it in the post build in build step tab.)
the android project is in the android folder( ~/Documents/workspace/[your
project name]/android)
simply,new an android project and modifying the game lib (always
from "game" to
[your project name]) in An[your project name].java are the only two things you need to do. However, Always, for the first time, the project will
have some errors with the resource R class.
therefore, please delete and import the project.
the two targets are run at the same time. just like the image below.
![](https://oscdn.geek-share.com/Uploads/Images/Content/202002/13/ca5b5b38b60fb0d7bde9c40206522407.gif)
I believe this way could imporve the efficiency of the development more or less.
I am an non-native English speaker, if you have any confusion about this doc, please direct it without any hesitate.
the script is named mycreate-android-project.sh in the base folder of cocos2dx. and before you read this, you had better read my first and second blog about cocos2dx for linux...
the step is like this for the first time to build the project.
1. build android ndk standalone environment, you reference my last blog here or get the guide from
http://www.srombauts.fr/android-ndk-r5b/docs/STANDALONE-TOOLCHAIN.html
2. As a project template Helloworld, you should set cocos2dx_loc first in preference->c/c++ build->build variables. cocos2dx_loc is the path to your cocos2dx base folder.
![](https://oscdn.geek-share.com/Uploads/Images/Content/202002/13/c7cc15f677a3c81c1cdada93fb2c9dce.gif)
3. Change some macros in mycreate-android-project.sh to work in your environment.
NDK_ROOT="/home/laschweinski/android/android-ndk-r5"
the root of ndk
ANDROID_SDK_ROOT="/home/laschweinski/android/android-sdk-linux_86"
The root of android sdk
COCOS2DX_ROOT="/home/laschweinski/git/cocos2d-x"
the root of cocos2dx
then to build the project, simple command is like this:
laschweinski@laschweinski-laptop:~/Documents/workspace$ sh ~/git/cocos2d-x/mycreate-android-project.sh
(you could create the project wherever you want)
4. import projects, and test in eclipse 3.7
import the project where you run the command (in this case,~/Documents/workspace/[your
project name]/linux) in your eclipse
besides, the project has 4 target, Debug and Release is for linux, and AndroidDebug, AndroidRelease is for android, default compiled to be a shared lib for ndk. after
compiling the project, the libs will be copied to android/libs/armeabi. (due to a shell named postCompile.sh executed after compiled automatically, and I configure it in the post build in build step tab.)
the android project is in the android folder( ~/Documents/workspace/[your
project name]/android)
simply,new an android project and modifying the game lib (always
from "game" to
[your project name]) in An[your project name].java are the only two things you need to do. However, Always, for the first time, the project will
have some errors with the resource R class.
therefore, please delete and import the project.
the two targets are run at the same time. just like the image below.
![](https://oscdn.geek-share.com/Uploads/Images/Content/202002/13/ca5b5b38b60fb0d7bde9c40206522407.gif)
I believe this way could imporve the efficiency of the development more or less.
I am an non-native English speaker, if you have any confusion about this doc, please direct it without any hesitate.
相关文章推荐
- Android 1.5 project in Eclipse and whenever I merely have an x
- 关于eclipse下运行maven build报 No plugin found for prefix 'jetty' in the current project and in the plu gi
- 如何将svn上checkout下来的android 程序由java project转成android project in Eclipse
- [转]eclipse android : A project with that name already exists in the workspace
- New Android Project In Eclipse with SDK 4.0
- android ;linux ;Plug-in org.eclipse.ajdt.ui was unable to load class
- Issues in Linux And Android
- Run Nutch In Eclipse on Linux and Windows nutch version 0.9
- How to remove native support from an Android Project in eclipse because eclipse is showing errors in
- Builds different channels of code in Android Studio and Eclipse.
- Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.
- A class file was not written. The project may be inconsistent, if so try refreshing this project and building it. eclipse提示错误
- How to create a project from existing source in Eclipse and then find it?
- import github project As Android Project In Eclipse
- Android project structure in Eclipse
- eclipse android : A project with that name already exists in the workspace
- Run Android apps in Windows, OS X, Linux with Chrome (and a modified runtime)
- android camera flow and V4L2 in linux kernel--------android 调用流程
- 如何将svn上checkout下来的android 程序由java project转成android project in Eclipse
- 从create-android-project.bat开始创建eclipse下可调试的cocos2dx c++工程