问题解决:cocos2d-2.0-rc2-x-2.0.1在android虚拟机运行报"don't support gles2.0"

最近在弄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.

问题解决:cocos2d-2.0-rc2-x-2.0.1在android虚拟机运行报"don't support gles2.0"_第1张图片


二、修改项目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

问题解决:cocos2d-2.0-rc2-x-2.0.1在android虚拟机运行报"don't support gles2.0"_第2张图片


备注:

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


你可能感兴趣的:(ios,android,虚拟机,windows,service,import)