Build new project instead of the helloworld project

I am trying to follow the tutorial http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Chapter_2*-*How_to_Add_a_sprite
and am able to make a screen with a ninja sprite on it in Visual Studio.
However I am unsure of how to reflect the changes to the android project in eclipse.
I have tried running create-android-project.bat then build_native.sh, but when I run the android application,
all I get is the basic hello world app.

I figured I am probably doing something wrong.

It sounds like your build_native.sh script isn’t seeing the updated file. Does your VS project and Eclipse project both point to the same source/class files? If they are in different locations then you have to update them in both areas…

R J wrote:

It sounds like your build_native.sh script isn’t seeing the updated file. Does your VS project and Eclipse project both point to the same source/class files? If they are in different locations then you have to update them in both areas…

So I have created the project in VS in C:/Dev/Cocos2dxFirstGame
and my root cocos2dx is in C:/Dev/cocos2d
when I run create-android-project.bat (in C:/Dev/cocos2d) it creates C:/Dev/cocos2d/Cocos2dxFirstGame
and I run build_native.sh in C:/Dev/cocos2d/Cocos2dxFirstGame/proj.android

I am not really sure on how to tell the create-android-project.bat to use the files in C:/Dev/Cocos2dxFirstGame

You shouldn’t have to keep running create-android-project.bat, you just do that once to set it up. My guess is that is overwriting the file you just updated :slight_smile: Try updating the file then just running build_native.sh then run in eclipse.

R J wrote:

You shouldn’t have to keep running create-android-project.bat, you just do that once to set it up. My guess is that is overwriting the file you just updated :slight_smile: Try updating the file then just running build_native.sh then run in eclipse.

That didn’t work.
But I think I know what the problem is. Just like you said I had 1 folder for VS and one for the android i.e.
VS build
C:2dxFirstGame
android build
C:2d\Cocos2dxFirstGame

so if I when I change a C*+ class in the VS build it doesn’t change the C*+ classes in the android build
how do I set it up so they use the same folder?
because if I put the VS build in
C:2d\Cocos2dxFirstGame
and then run the android-project.bat, with project name Cocos2dxFirstGame it will say that the folder already exists

The way I have it setup is how this site recommends. Your app should be in the main cocos2d-x dir, then in there you have a proj.* for each plateform, a classes folder, and a resources folder. So it would look like this:

cocos2d-x….AppName………Classes………Resources………proj.android………proj.win………proj.ios
So all of your c++ files and loadable files should be in Classes and Resources respectively. Then in VS the project should be in the proj.win, you tell it to point to the Classes folder for all the cpp files and in eclipse the project should be in proj.android and you tell it to look at the same Classes folder for the cpp files. This way, you only update one file for all projects.

I’m not working with VS/win, so I can’t tell you exactly how to do it in VS. Sorry.

R J wrote:

The way I have it setup is how this site recommends. Your app should be in the main cocos2d-x dir, then in there you have a proj.* for each plateform, a classes folder, and a resources folder. So it would look like this:
>
cocos2d-x\n> ….AppName\n> ………Classes\n> ………Resources\n> ………proj.android\n> ………proj.win\n> ………proj.ios\n>
So all of your c++ files and loadable files should be in Classes and Resources respectively. Then in VS the project should be in the proj.win, you tell it to point to the Classes folder for all the cpp files and in eclipse the project should be in proj.android and you tell it to look at the same Classes folder for the cpp files. This way, you only update one file for all projects.
>
I’m not working with VS/win, so I can’t tell you exactly how to do it in VS. Sorry.

Thanks for your help.
I got it to work by creating the VS project in cocos2d-x/AppName
then renaming that folder AppName (to AppNameV)
to run the create-android-project.bat with AppName
and copying the proj.android into the AppNameV and renaming AppNameV back to AppName so that it matches the structure you posted

I’ve noticed that I need to call
./build_native.sh clean && ./build_native.sh
or else the code won’t update.