这两天搞跨平台的东西,发现cocos2dx不能在模拟器上运行,在网上查了查竟然没有这样的问题,最后还是靠stackoverflow定位到cocos2dx英文论坛中,最终找到了解决方案。
1.使用的引擎版本 cocos2d-2.0-rc0a-x-2.0
2.创建一个android工程后,打开项目,比如项目名称为test,就打开test.java
修改如下(默认有detectOpenGLES20函数,在return中添加Build.FINGERPRINT.startsWith("generic") )
private boolean detectOpenGLES20()
{
ActivityManager am =
(ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
ConfigurationInfo info = am.getDeviceConfigurationInfo();
return (info.reqGlEsVersion >= 0x20000|| Build.FINGERPRINT.startsWith("generic"));
}
3.编辑AndroidManifest.xml如下,在最后添加
<uses-feature android:glEsVers