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"(下载的ndk存放路径)

2 导入Eclipse有三个报错,org.cocos2dx.lib找不到,两种解决方案:
(1)方案一:将路径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下
(2)方案二:导入工程cocos2d-x-2.2.2/cocos2dx

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


5 fstream.h: No such file or directory
将#include <fstream.h>
改为#include <fstream>,
然后加上using namespace std;

你可能感兴趣的:(跨平台,cocos2d-x,转andriod)