Import cocos2d library

Crap I have been at this for a while and I am totally lost, I can create an android project using cocos2d in eclipse but when I try and reference CCSpriteFrameCache, it can’t be resolved.
I figure I need to do something like http://code.google.com/p/cocos2d-android-1/wiki/Using but I have no idea how to import cocos2d into the workspace, well at least everything I tried has precluded me from being able to mark it as a library. Which I could do with a jar file quite easily. Can someone help me figure this out? I see that many of you seam to have no problem doing this probably it’s probably so easy no-one felt the need to document it.

I’d really like to get on with using sprite sheets but this is really holding me up.

Many Thanks.

Kent

Oh, dou you use cocos2d-android-1 or other version that implemented by java?
This forum is cocos2d-x, which is implemented by c++.

@Kent Simon
If you create a cocos2d-x project by create-android-project.bat/.sh, the libcocos2d.so is already linked in this project.
Can you post the error log you met when invoking CCSpriteFrameCache? I don’t know whether it’s a compilation error, or a link error.

`Minggo I have tried both implementations, right now I am focused on cocos2d-x, I would have been happy with cocos2d-android-1 if it was current and CCSpriteFrameCache had addSpriteFramesWithFile implemented in it.

`Walzer Wang
When I create a cocos2d-x project and then try and access a few classes they don’t resolve and the classes don’t appear in the workspace at all, although they are part of cocos2d and libcocos2d.so is linked to the project.

Description Resource Path Location Type
CCDirector cannot be resolved test.java /test/src/com/mysample/test line 33 Java Problem
CCSprite cannot be resolved test.java /test/src/com/mysample/test line 35 Java Problem
CCSprite cannot be resolved to a type test.java /test/src/com/mysample/test line 35 Java Problem
CCSpriteFrameCache cannot be resolved test.java /test/src/com/mysample/test line 32 Java Problem
CCSpriteFrameCache cannot be resolved to a type test.java /test/src/com/mysample/test line 32 Java Problem
CGSize cannot be resolved to a type test.java /test/src/com/mysample/test line 33 Java Problem

Thank you so much for your help.

Kent

Kent, it seems that you are invoking CCDirector, CCSprite interfaces in your java code?
Oh no, it must be called in the c*+ code. You can access them from the default HelloWorldScene.cpp. Cocos2d-x games must be written in c*+ currently.
Without a JNI wrapper, the c++ interfaces are not exported to Java layer. We haven’t planned it yet.

Yes, well that answers my question, thanks.

Is anyone working exclusively from within eclipse IDE using c++ to develop an android app?

-Kent

@Kent, you can take a look at this document http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Installation_guide_of_Android_ndk_r4b_development_environment#5-Integrate-NDK-development-in-Eclipse
Yesterday, I just translated this blog of my friend, a famous android expert in China. But I haven’t try the section of “Integrate NDK development in Eclipse”. Good luck!