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

非常多新手程序员做出一个游戏后,编译成apk安装在手机上。却发现安装程序名和游戏图标都是Cocos2dx默认的,并且默认屏幕方向是横向。那么须要怎么才干改动为自己想要的呢?

打开你创建的project-找到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 esvalues下。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"

原文地址:https://www.cnblogs.com/zsychanpin/p/7390595.html