How to Build an Android Project with Eclipse

How to Build an Android Project with Eclipse

Environment Requirements

We will be using OS X in this example. The process on Win32 and Linux is more or less the same.

Prerequisite

Once completed:

Open the proj.android project with Eclipse.

  • Launch Eclipse

  • Right click your mouse at the empty area of the Package Explorer and choose Import....

  • Choose Existing Android Code Into Workspace from the pop up dialog and Click Next.

image2

  • Click the Browse... button to choose the directory of Cpp-Tests' proj.android. and Click Ok.

Before choosing the proj.android directory:
image3

After choosing the proj.android directory:
image4

  • Click Finish.

If all the above processes are correct, the Finish button will be enabled and you should click it.

image5

Import Libcocos2dx Project

This is more or less the same process as we do in the previous section except for the path of the proj.android is different.

The path of the libcocos2dx project is [your own game project folder]/cocos/2d/platform/android/java.

(Note:Here you must select the project right under your own project!!)

Build and Run the Android Project

  • Connect your Android phone with USB remote debugging option enabled.

  • Make sure your computer can recognize your phone (you might need to install drivers for your specific phone)

  • Right Click The CppTests project and choose Run as... -> Android Application.

image6

Build an Empty Project Created with the cocos command

Build it with the cocos command

(Note this might not be the same as the previous section, but you can do it by navigating to the proj.android directory and run the build_native.py scripts.)

We could use cocos run -s ~/MyCompany/MyGame -p android command instead of the python scripts. You could refer to this document for more information.

Open the proj.android project with Eclipse

It's exactly as the process we do in the previous example, above.

Import the Libcocos2dx Project

It's exactly as the process we do in the previous example, above.

Build and Run the Android Project

It's exactly as the process we do in the previous example, above.

TroubleShootings

  • If you get errors in the Eclipse when you imported the Android project. Don't worry, just import the libcocos2dx project will get ride of it.

  • If you imported all the projects and the errors remains, you might need to build the libcocos2dx project manually and to see whether there is a libcocos2dx.jar file under the bin directory.

  • If you installed the project in your Android phone but it crashed when launching. You should make sure there is a libxxx.so file under the libs/armeabi directory.

image6.png (206.6 kB) owen, 2014-04-02 06:12

image1.png (11.7 kB) owen, 2014-04-02 06:12

image2.png (63.2 kB) owen, 2014-04-02 06:12

image3.png (240.9 kB) owen, 2014-04-02 06:12

image4.png (275.1 kB) owen, 2014-04-02 06:12

image5.png (153.9 kB) owen, 2014-04-02 06:12

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值