Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers 2

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
  2. jni\tests\android.mk (or equivalent address based on your project name)

in the first file add

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
share|improve this answer
    
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. –  Ef Es Mar 19 '12 at 13:12
    
@EfEs updated my answer. –  Ali.S 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 :( –  Ef Es 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. –  Ef Es 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. –  Ef Es Apr 1 '12 at 1:22
show 1 more comment
up vote 0 down vote accepted

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")

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.