zoukankan      html  css  js  c++  java
  • Cocos2d-x 3.x 如何编译成安卓程序

    1.安装JDK

    2.安装eclipse,安卓官方现在不提供eclipse for android,只好自己配置了。首先安装一个eclipse,在Help——Install New SoftWare中安装ADT

    地址为http://dl-ssl.google.com/android/eclipse

    可能需要漫长的等待。

    3.创建AVD。根据http://www.cocos2d-x.org/boards/6/topics/12563 所说,需要安装4.0.3以上的虚拟机。

    4.在eclipse中导入proj.android工程,会自动编译,需要等待几分钟。

    编译完成后,发现有一个错误提示,从工程——cocos2d——cocos——platform——android——java——src中将org和com文件夹拷贝到当前工程中,错误提示消失。

    5.在虚拟机运行的时候,又遇到了另一个错误:

    java.lang.IllegalArgumentException: No configs match configSpec

    解决方法:

    ①在AndroidMainfest文件中将<uses-feature android:glEsVersion="0x00020000">改为
    <uses-feature android:glEsVersion="0x00020000" android:required="true" />

    ②在android-sdk安装目录下的 samplesandroid-16ApiDemossrccomexampleandroidapisgraphics里

    GLES20Activity.java中的方法detectOpenGLES20,修改成

    复制代码
    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'));  
        }  
    复制代码

    ③在AVD设置中勾选Use Host GPU

    6.终于正常运行了!另:在manifest中修改为android:screenOrientation="portrait"可以设为竖屏,默认为横屏。

  • 相关阅读:
    栈溢出笔记1.3 准备Shellcode
    聊聊手游的那些惊喜与惊吓
    GIS+=地理信息+容器技术(4)——Docker执行
    与AQS有关的并发类
    HDU 2102 A计划
    生产系统ELK日志采集系统
    datagrip离线安装驱动jar
    oracle无效索引重建
    18年总结及19年展望
    shell符号解释
  • 原文地址:https://www.cnblogs.com/DswCnblog/p/4379377.html
Copyright © 2011-2022 走看看