Vusial studio Compiling Cygwin..

Hi,

I shudnt ask for this but can any but help me port my code for android…

I have created a small test app on visual c++ and i want to export an apk file out of the exe.

The tutorial on the forum is going bouncer for me.

Can any body explain me in a easy way how do i get my win32 game to the android device.

Help

regards,
Rakesh

Hi, Rakesh.

It’s nice to know you made your game.

Unfortunately you can not use the exe file generated by Visual Studio in the Android’s apk.

Once you have your game running, it means that you should be able to compile it for Android with little or no hassle.

You can follow the tutorial http://www.cocos2d-x.org/projects/cocos2d-x/wiki/How_to_run_HelloWorld_on_ndk_r4_and_r5

Just use your game instead of the HelloWorld tutorial and you should be fine.

If you have any problems following it, please tell us exactly what you’re doing, what are your environment and what’s going wrong so we can try to help.

Regards.


My Blog
Follow me on Twitter
My Site

Hi Marcio,

Thanks for the reply.

Basically i have all my codes ready and i have also followed the tutorial on the link you provided. But i am not successful in building an apk file.

i get these errors in the cygwin command prompt.

Cannot create directory: No such file or directory present.
./ndk: no such file or directory exists.
and few more.

I have cygwin 1.7, ndk r6, and

ANDROID_NDK_ROOT=C:-ndk-r6-windows\android-ndk-r6
COCOS2DX_ROOT=C:2d-x
HELLOWORLD_ROOT=$COCOS2DX_ROOT/HelloWorld/android

Basically i am trying first with the hello world example and if this compiles then ill try for my game.

regards,
Rakesh

Hi,
I changed my ndks path and kept it directly on cdrive
now i get new error… it says
Cannot find ‘make’ program please install cygwin make package……
or define the GNUMAKE variable to point to it…

best,
rakesh

It compiled but where is the .apk file stored?/

I’m glad to hear you’ve compiled your game for android.

Once you got your native code compiled you must do the following:

Open your Eclipse. You must have both android *S*DK and Google’s ADT plugin installed.

First of all, you must create a pair of keys in order to signing you game. Follow the article http://developer.android.com/guide/publishing/app-signing.html (look for 1. Obtain a suitable private key).

In Eclipse, click on File~~>Import and then choose “Import existing projects into workspace”
Then select the folder where is the android project.
Let me say your game is named MyGame. You should import the folder >
Click in Project~~>clean (Please, make shure that the Project~~>Build automatically is checked).
It will compile you game and generate an apk into bin folder
This file can be used for tests purpouses only but you cannot submit it to Android Market.
Apks must be signed in order to submit them to Android market.

Then click in File~~>Export then Android->Export Android Application

Follow the steps and it will generate an apk ready to be deployed on Android Market. This file (MyGame.apk) will be in the folder >

I hope it solve your problem.

Regards

My Blog
Follow me on Twitter
My Site

For future reference, if you get an error about ‘make’ when you are using cygwin, that means that you do not have ‘make’.

So what you need to do is install it. Just run the cygwin setup, search for ‘make’ and install it.

On a side note, you’re gonna have to update the ‘make’ file at “android/jni/projectname/Android.mk” so that it includes your class source files:
LOCAL_SRC_FILES := main.cpp …/…/…/Classes/AppDelegate.cpp …/…/…/Classes/HelloWorldScene.cpp …/…/…/Classes/Scenes/SceneMain.cpp …/…/…/Classes/Objects/Player.cpp …/…/…/Classes/Objects/Portal.cpp

Thanks @ Marcio,

I shall do that asap i get to my hopme PC after work.

Thankyou @ sparkart,

Yes i did found the same solution and fixed it . And thanks for the makefile info as i am pretty new to makefiles this gave me an clearer idea.

Cheers
Rakesh

Hi,

Failure…

I tried importing the hello world project but the selection window says no project found even when i direct it to the correct path.
Basically i have a project made on visual c++ and after the steps shown here
http://www.cocos2d-x.org/projects/cocos2d-x/wiki/How_to_run_HelloWorld_on_ndk_r4_and_r5#3-Running

It compiles and generates .so files in libs/armeabi folder.

So is it the only thing the above link generates? if not what am i doing wrong and what do i do now?

Regards,

Rakesh.

My bad. Sorry.

The correct steps are:

On Eclipse, click on

File->New Project

It will open a window.

Choose Android -> Android Project

Another window will open.

In project name type what ever you want (I would put my project name)

Click in the radio button Create project from existing source.

It will enable a browse button where you will be able to select the directory. Click in int to select the directory

/YOUR_GAME/android

In the build target select the at least android 2.1 and then click ok.

Regards

My Blog
Follow me on Twitter
My Site