# Importing a windows project into android using cocos2d-x

What I am trying to do today is to import a full project to Android, but no tutorials are available for that that I have seen. My approach was to create a new android project, copy all the classes and resources in the folders and calling ./build_native.sh but I get an error because most of the files are not being included in the project. I tried opening the Android.mk and I can see why "LOCAL_SRC_FILES := AppDelegate.cpp \ HelloWorldScene.cpp" are the only files linked.

Should I manually modify the make file or can it be automated by some way I don't know?

Thank you.

UPDATE:

I manually added all files and headers to the make file and I get errors linking Box2D or cocosdenshion libraries.

just add every file with cpp extention in your project into "LOCAL_SRC_FILES list", and of course if you don't have a file named "HelloWorldScene.cpp", remove it from that list.

UPDATE

I'm not sure this time but I'm guessing from what I can see inside test project: there are two file with name "android.mk"

1. jni\android.mk

subdirs := $(addprefix$(LOCAL_PATH)/../../../,$(addsuffix /Android.mk, \ Box2D \ cocos2dx \ CocosDenshion/android \ ))  note that $(LOCAL_PATH)/../../../ should point at cocos2dx root folder change it if it is not correct

and in the second file this line should do the trick

    LOCAL_SHARED_LIBRARIES := cocosdenshion_shared box2d_shared

• I just added an update: UPDATE: I manually added all files and headers to the make file and I get errors linking Box2D or cocosdenshion libraries. – MLProgrammer-CiM Mar 19 '12 at 13:12
• @EfEs updated my answer. – Ali1S232 Mar 19 '12 at 14:13
• I did test it, it correctly imports the libraries but I can't say it is the answer because I still get a lot of project-related problems, sorry :( – MLProgrammer-CiM Mar 19 '12 at 14:42
• I tried using another build_native from previous version and everything looks like working, but I get realtime problems when calling System.loadLibrary("cocos2d"); If you want to help send me a message or we can talk in chat. Thanks. – MLProgrammer-CiM Mar 19 '12 at 14:51
• The problem was that someone else had updated the libraries in the SVN under a different name. Question closed. – MLProgrammer-CiM Apr 1 '12 at 1:22

The problem was the library naming, as the standard Android project has the library names as "cocos2d" (my project had cocos2dx) and "cocosdenshion" (case sensitive into "CocosDenshion")