Hi guys, i faced a little problem here

Hi guys, i faced a little problem here
0.0 0


So i tried to download an example of Cocos2dSimpleGame, then i changed build-native.sh file so that passes where pointing on the folders with ndk and cocos2dx, then when i started buildnatives - everything seemed to compile fine, exept for couple of warnings :

CCScheduler.cpp: In member function ‘void cocos2d::CCTimer::update(cocos2d::ccTime)’:
CCScheduler.cpp:160: warning: NULL used in arithmetic

CCImage.cpp: In member function ‘bool cocos2d::CCImage::_initWithPngData(void*, int)’:
CCImage.cpp:238: warning: ‘png_info_struct::color_type’ is deprecated (declared at /Users/user/src/Cocos2dxSimpleGame/Cocos2dxSimpleGame/android/jni/…/…/…/cocos2dx/platform/third_party/android/libpng/png.h:650)
CCImage.cpp:238: warning: ‘png_info_struct::color_type’ is deprecated (declared at /Users/user/src/Cocos2dxSimpleGame/Cocos2dxSimpleGame/android/jni/…/…/…/cocos2dx/platform/third_party/android/libpng/png.h:650)

Then i zip the whole android folder and send it to my colleague who is an android developer and asked him to run this project, personally i don’t know java or android at all, and doesn’t have time to look for this problem , so i hope someone of you faced this before and know what to do, or you can give me a clue what it is with the problem. here is the error he gets:
07-11 16:09:38.716: ERROR/AndroidRuntime(17694): FATAL EXCEPTION: GLThread 12
07-11 16:09:38.716: ERROR/AndroidRuntime(17694): java.lang.NoSuchMethodError: createTextBitmap
07-11 16:09:38.716: ERROR/AndroidRuntime(17694):     at org.cocos2dx.lib.Cocos2dxRenderer.nativeInit(Native Method)
07-11 16:09:38.716: ERROR/AndroidRuntime(17694):     at org.cocos2dx.lib.Cocos2dxRenderer.onSurfaceCreated(Cocos2dxRenderer.java:15)
07-11 16:09:38.716: ERROR/AndroidRuntime(17694):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1348)
07-11 16:09:38.716: ERROR/AndroidRuntime(17694):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)

so looking forward for your answers i really like cocos2dx but it just seems to be to complicated to me)))
hope someone answers soon, thanks in advance


At first, there’s no any relation between the warnings and the running failure.

createTextBitmap is a method in Cocos2dxSimpleGame/android/src/org/cocos2dx/lib/Cocos2dxBitmap.java, and you failed in cocos2dx/platform/android/CCImage_android.cpp when try to find this java method. So please check if your friend build and pack the Cocos2dxBitmap.java in his project.


I have a good idea Walzer :slight_smile: can you provide me with your version of android package, I then compare this version with the one i got, and probably see what was wrong :))
Mm, sorry to bother you ….


Yes, we checked and Cocos2dxBitmap.java is ok, maybe you can have a quick look on a project that i have, see what is wrong :slight_smile:


Ok, somehow the problem disappeared by itself, i downloaded cocos2d-x from github, then putted Cocos2dSimpleGame in that folder, and now it compiled and worked, without any visible reasons :))) Now i’m really looking for someone to write a good manual of how to port existing Cocos2d games to Cocos2dx :slight_smile:
cheers !


Hi, Iegor, so sorry I’m outside for some case today, and didn’t reply you in time.
I’ll re-test the Cocos2dxSimpleGame zip ball on android. But can you tell me your development environment?
* OS: Mac OS X, Ubuntu, or else
* Android SDK version
* Android NDK version

And these tutorials are what you looking for http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Tutorials They describe how to port Cocos2dSimpleGame from objc to c++, and list the key points.


Yeah, I read this tutorials.
MacOS 10.6, android-ndk-r5c, sdk - 2.2