cocos2dx转Andriod常见问题
1 NDK_ROOT not defined. Please define NDK_ROOT in your environment or in local.properties 在路径cocos2d-x-2.2.2/samples/Cpp/HelloCpp(功成名)/proj.android下的build_native.sh文件中的 APPNAME="HelloCpp"下添加:
NDK_ROOT="/Users/user/Documents/android-ndk-r9c"2 导入Eclipse有三个报错 将路径cocos2d-x-2.2.2/cocos2dx/platform/android/java/src/org/cocos2dx/下的lib拷贝到 cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android/src/org/cocos2dx下
3 The connection to adb is down, and a severe error has occurred.
(1) 重启Eclipse (2 )如果重启不行的话就cd到platform-tools下键入adb kill-server ,如果adb关闭了会提示 server not running *,再输入adb start-server 如果不成功会提示 daemon not running. starting it now on port ***的而如果成功的话不提示任何语句的.这时再重新打开eclipse就可以正常运行模拟器的了.
4 unfortunately, hellocpp has stopped
I fixed the problem by add the following lines in Cocos2dxActivity.java:
// …add to FrameLayout
framelayout.addView(this.mGLSurfaceView);
// NOTICE: to comment it out when you release the application
this.mGLSurfaceView.setEGLConfigChooser(8 , 8, 8, 8, 16, 0);
The problem is because Android emulator can’t support OpenGL ES 2.0 well. But my “solution” is a only a temporary one when you run application in emulator. (The app is fine when I run the app in real device.)