Android Emulator 不能运行cocos2dx的解决方案
2015-09-01 21:02
561 查看
这两天搞跨平台的东西,发现cocos2dx不能在模拟器上运行,在网上查了查竟然没有这样的问题,最后还是靠stackoverflow定位到cocos2dx英文论坛中,最终找到了解决方案。
1.使用的引擎版本 cocos2d-2.0-rc0a-x-2.0
2.创建一个android工程后,打开项目,比如项目名称为test,就打开test.java
修改如下(默认有detectOpenGLES20函数,在return中添加Build.FINGERPRINT.startsWith("generic") )
[java] view
plaincopyprint?
private boolean detectOpenGLES20()
{
ActivityManager am =
(ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
ConfigurationInfo info = am.getDeviceConfigurationInfo();
return (info.reqGlEsVersion >= 0x20000|| <span style="color:#ff0000;">Build.FINGERPRINT.startsWith("generic")</span>);
}
3.编辑AndroidManifest.xml如下,在最后添加
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
[html] view
plaincopyprint?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sx.test3"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8"/>
<application android:label="@string/app_name"
android:debuggable="true"
android:icon="@drawable/ic_launcher">
<activity android:name=".test3"
android:label="@string/app_name"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:configChanges="orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<supports-screens android:largeScreens="true"
android:smallScreens="true"
android:anyDensity="true"
android:normalScreens="true"/>
<span style="color:#ff0000;"><uses-feature android:glEsVersion="0x00020000" android:required="true" /></span>
</manifest>
4.编辑Emulator,如下需要开启GPU
5.运行cocos2dx的android工程,如下
参考地址:
http://www.cocos2d-x.org/boards/6/topics/12563 (最终解决方案)
http://stackoverflow.com/questions/12203918/failure-in-running-helloworld-cocos2dx?rq=1
https://github.com/cocos2d/cocos2d-x/issues/1080
1.使用的引擎版本 cocos2d-2.0-rc0a-x-2.0
2.创建一个android工程后,打开项目,比如项目名称为test,就打开test.java
修改如下(默认有detectOpenGLES20函数,在return中添加Build.FINGERPRINT.startsWith("generic") )
[java] view
plaincopyprint?
private boolean detectOpenGLES20()
{
ActivityManager am =
(ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
ConfigurationInfo info = am.getDeviceConfigurationInfo();
return (info.reqGlEsVersion >= 0x20000|| <span style="color:#ff0000;">Build.FINGERPRINT.startsWith("generic")</span>);
}
3.编辑AndroidManifest.xml如下,在最后添加
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
[html] view
plaincopyprint?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sx.test3"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8"/>
<application android:label="@string/app_name"
android:debuggable="true"
android:icon="@drawable/ic_launcher">
<activity android:name=".test3"
android:label="@string/app_name"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:configChanges="orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<supports-screens android:largeScreens="true"
android:smallScreens="true"
android:anyDensity="true"
android:normalScreens="true"/>
<span style="color:#ff0000;"><uses-feature android:glEsVersion="0x00020000" android:required="true" /></span>
</manifest>
4.编辑Emulator,如下需要开启GPU
5.运行cocos2dx的android工程,如下
参考地址:
http://www.cocos2d-x.org/boards/6/topics/12563 (最终解决方案)
http://stackoverflow.com/questions/12203918/failure-in-running-helloworld-cocos2dx?rq=1
https://github.com/cocos2d/cocos2d-x/issues/1080
相关文章推荐
- cocos2dlua-声音
- cocos2dlua-动画
- cocos2dlua-精灵
- cocos2dlua-图层
- cocos2dlua-场景
- cocos2dlua-导演
- cocos2dlua-创建一个游戏
- Cocos2D-X设计模式:中介者模式
- Cocos2D-X设计模式:观察者模式
- 从今天开始学习cocos 2d js
- cocos2dx设置音量之前一定要tmd播放!!
- 安卓:Cocos2dxActivity cannot be resolved to a type
- cocos2dx setGlobeZOrder setLocalZOrder setOrderOfArrival
- cocos2dx Auto-batching的使用
- cocos2d-x特效之CCControlPotentiometer
- Cocos2D-X设计模式: 组合模式
- 火云开发课堂 - 《使用Cocos2d-x 开发3D游戏》系列 第十节:描边效果处理
- Cocos2d-x从入门到精通第八课《坐标系统》
- Cocos-2d 坐标系及其坐标转换
- cocos2dx tolua c++