Get the UE5.2 source code version, install it, compile it, create a new project, and the whole process of Android packaging (detailed explanation)

Table of contents

1. Obtain the source code version of UE5.2

2. UE5 source code compilation (VS2022 is recommended) 

3. UE5 source code version creates a new project and opens it

4. Android platform packaging (this stage is the highlight)

1. Under normal circumstances, it is recommended to choose the default path for all installation paths, so that you do not have to modify the SDK path everywhere, but if you are like a blogger and your username contains Chinese characters (you will remember it next time)

2. Although the tutorial says that the following step is necessary for UE 4.27, 5.0 and 5.1, if you are UE5.2, it is recommended to complete this step.

3. At this point you need to modify the SetupAndroid.bat file.

4. Add Alibaba Cloud's domestic image warehouse address configuration to prevent failure to download dependency packages during later packaging.

5. Refer to the experiences of other bloggers

6. Start the settings inside the UE editor

6. Pack up!


1. Obtain the source code version of UE5.2

1. Link your Epic account and Github account. Because Epic's UE engine source code library is a private library, you need to join the Epic warehouse to pull the source code. For detailed operations, see the official website link: Unreal Engine on GitHub - Unreal Engine icon-default.png?t=N7T8https://www.unrealengine.com/zh-CN/ ue-on-github

 Using magic, after pulling the source code from Github, you will get a file directory like this:

2. Find the Setup.bat file, double-click to run it, and start downloading various dependencies. You only need to keep the network open for this step. Don't forget to leave enough space for UE in advance. (You can refer to Baidu for details depending on the version. 4.26 is about 150-200G, and 5.2 is about 200-300G). This process requires downloading about 20G of data, mainly various templates and third-party libraries.

2. UE5 source code compilation (VS2022 is recommended) 

1. Double-click to run the GenerateProjectFiles.bat file to generate the VS project file. It is recommended to use VS2022. After downloading the project file, the UE5.sln file will be generated in the current file directory. If you are missing some necessary tool packages at this time, VS2022 will prompt you to install them above the solution bar to get the complete experience. After the installation is completed according to the prompts, open UE5.sln and prepare for compilation.

2. Set UE5 as the startup item, then debug- > start execution. Then the long debugging process will begin.

        UE5 probably needs to compile 6000+ files. After compilation is completed, you can find the newly generated UnrealEditor.exe file in the Engine/Binaries/Win64 directory and double-click to run it.

3. UE5 source code version creates a new project and opens it

Just create UE game-related templates according to your needs. Note that if you want to run tests on the Android platform, the following options are recommended:

Target platform: mobile platform

Quality Preset: Scalable

Otherwise, the subsequent packaging time will be very long.

        After creating the project, the source code version will not open the UE editor interface, but will pop up the VS interface. If you want to open the project at this time, select the created project, and then start execution. After the compilation is completed, the just created project will be will open.

4. Android platform packaging (this stage is the highlight)

The official documents have very detailed tutorials. It is recommended to refer to the official documents step by step at the beginning https://docs.unrealengine.com/5.2/zh-CN/android-support-for-unreal-engine/

Here I will add some things besides the official tutorial.

        If a pop-up window appears before the Android Studio Setup Wizard , click Cancel and then select Custom. All subsequent operations will be the default options .

1. Under normal circumstances, it is recommended to choose the default path for all installation paths, so that you do not have to modify the SDK path everywhere , but if you are like a blogger and your username contains Chinese characters (you will remember it next time)

        In this step, it will prompt you that the path contains non-ASCII codes, so you cannot install it in a named directory. The installation path can be modified at this time. We will talk about where the path needs to be modified later.

2. Although the tutorial says that the following step is necessary for UE 4.27, 5.0 and 5.1, if you are UE5.2, it is recommended to complete this step.

If you don't find version 8.0, check Show Package Details in the lower right corner to download version 8.0.

3. At this point you need to modify the SetupAndroid.bat file.

① After following the official website tutorial to find the file, open the file in text file format. If you did not modify the default path in the previous step, follow the official website tutorial and change latest to 8.0. But if you modify the path, you need to change the path after the = sign to the path of your current sdkmanager.bat, refer to my path:

Otherwise, if you double-click the SetupAndroid.bat file, the following words will appear in the small black window:

②If you double-click to run the file, the following words will appear:

        This is the second location to be modified. Find the top sentence, set ANDROID_LOCAL, and change it to the file location after you changed the default path in the first step.

③Change the Android component version information and find the following statement in the SetupAndroid.bat file:

        In fact, this paragraph represents the minimum compilation requirements for this version of the engine to release the components required for Android. The batch file will ask Android Studio to download the components required for UE according to these items. The above are the parameters modified by the blogger. If you follow the default parameters given to you, the UE version may not match the components required by Android, and an error may be reported during packaging.

        It is recommended that the parameters at this time be modified according to the parameters of the blogger above (UE5.2). If you have other versions, it is recommended to refer to the official website for the configuration required for the UE engine.

        After completing the above steps, remember to save the file and restart the computer . Then double-click the SetupAndroid.bat file to run . The command line window will begin to execute the batch file, and the following message will appear: Success: The specified value is saved. Please press any key to continue... Indicates that this step is OK. It doesn’t matter if the license agreement in the official documentation does not appear.

4. Add Alibaba Cloud's domestic image warehouse address configuration to prevent failure to download dependency packages during later packaging.

        First find the template file, refer to the file directory C:\Program Files\Android\Android Studio\plugins\android\lib\templates\gradle-projects\NewAndroidProject\root to find build.gradle.ftl

        By default, content cannot be written to this file. You need to modify the write permission first. Right-click build.gradle.ftl → Properties → Security → Click Edit → Select the user identity (User) you use to access the system in the group or user name column. →Check Allow Full Control in the permission bar→then click OK to save .

Open build.gradle.ftl with notepad and add configuration in the target location

maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}

5. Refer to the experiences of other bloggers

        You need to add a file under the previously changed path. If it has not been changed, use the default path and create a new repositories.cfg file. That being said, I don’t know if this file is useful, but I’ll add it just in case.

6. Start the settings inside the UE editor

Open the editor, Edit->Project Settings->Android SDK, if it is blank, you need to configure it manually.

First line parameters:

Default path used: {User}/AppDate/Local/Android/Sdk

If the default path is modified, fill in your modified path.

Second line parameters:

Default path used: {User}/AppDate/Local/Android/Sdk/ndk/version number

The default path has been modified. Then find the folder with version number under ndk under the modified path.

The third line of parameters:

The default path is used: C:/Program Files/Android/Android Studio/jre

The fourth line of parameters:

You can check the version number of the SDK you downloaded in Android Studio

It is recommended to use version 30.0.0         here . So the fourth line parameter : android-30 . The fifth line of parameters: android-25 . Also check the ndk version on the same interface above.

        After the above steps are completed, come to the Android interface and click Configure Now in the two locations shown below . Then check Package game data inside apk in Figure 1 .

6. Pack up!

        Select a folder to store the packaged files, and then an apk file will be generated in the corresponding folder. After sending this file to your mobile phone for download, you can start playing!

Guess you like

Origin blog.csdn.net/m0_63673681/article/details/132857358