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"可以设为竖屏,默认为横屏。

  • 相关阅读:
    python BeautifulSoup库的基本使用
    python操作RabbitMQ
    MySQL主从复制
    python字典与集合操作
    常见术语
    Mac下如何使用homebrew
    springboot整合freemarker
    Servlet与JSP概念理解
    slf4j-api、slf4j-log4j12以及log4j之间什么关系?
    使用nodeJs安装Vue-cli并用它快速构建Vue项目
  • 原文地址:https://www.cnblogs.com/DswCnblog/p/4379377.html
Copyright © 2011-2022 走看看