Cocos2d-x 3.0 Android修改APK名、更改图标、修改屏幕方向、修改版本号,一些需要注意的问题

来源:互联网 发布:优美图软件下载 编辑:程序博客网 时间:2024/06/05 20:46

很多新手程序猿做出一个游戏后,编译成apk安装在手机上,却发现安装程序名和游戏图标都是Cocos2dx默认的,而且默认屏幕方向是横向,那么需要怎么才能修改为自己想要的呢?

打开你创建的工程-找到proj.android,找到AndroidManifest.xml并编辑:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.Irvingrain.hellocpp"
      android:versionCode="1"

//这里已经给我们提示当前程序的版本号。
      android:versionName="1"

//这里已经给我们提示当前程序的版本名称,例如1.1、1.2,如果需要修改游戏版本可以修改这个值。

      android:installLocation="auto">


    <uses-sdk android:minSdkVersion="9"/>
    <uses-feature android:glEsVersion="0x00020000" />


    <application android:label="@string/app_name"//这里已经给我们提示:@string/app_name说明在string.xml定义了app_name
                 android:icon="@drawable/icon">
 
        <!-- Tell Cocos2dxActivity the name of our .so -->
        <meta-data android:name="android.app.lib_name"
             android:value="cocos2dcpp" />


        <activity android:name="org.cocos2dx.cpp.AppActivity"
                  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:anyDensity="true"
                      android:smallScreens="true"
                      android:normalScreens="true"
                      android:largeScreens="true"
                      android:xlargeScreens="true"/>


    <uses-permission android:name="android.permission.INTERNET"/>
    <!--uses-permission android:name="android.permission.WAKE_LOCK" 禁止手机休眠/-->
</manifest> 

1.修改程序名:打开proj.android\res\values下,string.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">
程序名</string>
</resources>

//如果安装游戏后出现游戏中文名乱码,估计是你这个string.xml的编码有问题,建议用EditPlus把这个文件编码更改为UTF-8后覆盖。

2.修改游戏图标:

打开 proj.android/res,这个文件夹下面有三个文件夹drawable-hdpi、drawable-mdpi、drawable-ldpi,

将自己要修改成的图标按原来的像素制作好后覆盖,如果安装到手机图标还是没有改变,那个估计是之前留下的缓存,

建议卸载游戏后先清理系统垃圾和缓存文件再重新安装,即可解决。

3.修改屏幕的方向:修改上面的AndroidManifest.xml,找到android:screenOrientation:

默认是横屏landscape,竖屏是portrait。

4.修改游戏版本号修改上面的AndroidManifest.xml,找到android:versionName="1",

修改这个数值,如(1.1、1.2)

对应如果android:versionName="2",建议android:versionCode="2"

0 0