最近在弄cocos2d-x的ios和android开发,在mac下配置ios的环境很简单,但是配置android环境在虚拟机运行遇到了"don't support gles2.0"的问题。
问题解决步骤如下:(在mac下解决,相信windows下也一样)
一、虚拟机设置:GPU emulation enabled、SDK 4.0.3、API 15
参考:http://www.raywenderlich.com/12065/how-to-create-a-simple-android-game
- Emulator: If you are using the emulator to test AndEngine code, you need a virtual device which has GPU emulation enabled and is running at least Android 4.0.3. So check your virtual device configuration and edit it if your device is not set up appropriately.

二、修改项目src/com.sinaapp.blueslf包/cocos2dxandroid220类(替换为自己相应的路径)下面方法detectOpenGLES20(),return里面增加条件"|| Build.FINGERPRINT.startsWith("generic"));"
参考:https://github.com/cocos2d/cocos2d-x/issues/1080
import android.os.Build;
private boolean detectOpenGLES20()
{
ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
ConfigurationInfo info = am.getDeviceConfigurationInfo();
return (info.reqGlEsVersion >= 0x20000 || Build.FINGERPRINT.startsWith("generic"));
}
三、运行cocos2d-2.0-rc2-x-2.0.1

备注:
1、在mac下如何配置cocos2d-x的ios和android环境,请参考:http://www.raywenderlich.com/11283/cocos2d-x-for-ios-and-android-getting-started
2、如何搭建android环境,请参考:http://www.raywenderlich.com/5527/getting-started-with-android-development

在使用cocos2d-x进行Android开发时,遇到在虚拟机运行时报'不支持gles2.0'的问题。通过调整虚拟机设置,启用GPU模拟并设定为API 15,以及修改cocos2dxandroid220类中detectOpenGLES20方法,添加特定条件,成功解决了问题。参考Ray Wenderlich的教程可以了解更多配置环境的步骤。
1176

被折叠的 条评论
为什么被折叠?



