About the detailed steps of unity packaging Android apk

Xiaobai's experience, if there are any shortcomings, please point out

Step 1: If you want Unity to package Apk, you need to download a version of JDK7 or above (including 7). 
and must be 64-bit. 

Remember your installation path when installing 

The following is the jdk of JAVA shared

Link: https://pan.baidu.com/s/1Dw1d12RCp_i8MstGlDMHdQ Password: llu0

After the download is complete, decompress it: 
it must be placed in a place that you can remember, and there cannot be a Chinese path

Installing JDK Selecting the Installation Directory During the installation process, there will be two installation prompts. The first time is to install jdk and the second time is to install jre. It is recommended that both be installed in different folders within the same java folder. (Cannot be installed in the root directory of the java folder, jdk and jre installed in the same folder will make an error)

As shown below

1: Install jdk, choose a directory at will, just modify the directory before the default installation directory \java

2: Install jre → change → \java The directory before the installation is the same as the jdk directory

Note: If there is no installation directory requirement, it can be set by default. No need to make any changes, just click Next both times.


Configure the environment variables after installing the JDK Computer→Properties→Advanced System Settings→Advanced→Environment Variables


System Variables → New JAVA_HOME variable.

The variable value fills in the jdk installation directory


System Variables→Find Path Variable→Edit

Enter %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin; at the end of the variable value

(Note whether there is a ; sign at the end of the variable value of the original Path, if not, enter the ; sign first and then enter the above code)

System Variables → New CLASSPATH Variable

Fill in the variable value .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar (note the first point)

System variables are configured

The next step is to test whether the configuration of the environment variables is successful or not. Enter "JAVAC" in the DOS command line window, and the output of the help information means the configuration is correct. As shown in the figure:


After the first configuration is done, install the Android SDK and share my sdk

Link: https://pan.baidu.com/s/1UtV7btmlmComVob8MKh7cg Password: 7yeg

After the download is complete, unzip it: 

It must be placed in a place that you can remember, and there must be no Chinese path.

Finally, let unity recognize your JDK and SDK

First, * open Unity's Preferences*


Then, *click External Tools, the red box is where you need to fill in the JDK and SDK*

If there is no thing in the red box, we need to download the plugin UnitySetup, the following is the link of my 5.6.5 version

Link: https://pan.baidu.com/s/1BPROuJrALv4_4mDvTYu0rQ Password: ifqb

Other versions do not check UnitySetup when installing Unity. It doesn't matter if you find it as follows, just click to download


Next, choose the path



In order to prevent some people from making a mistake, I will state it here. 
The Android SDK Location filled in is the path where the downloaded SDK is decompressed 

JDK Location fills in the path of the JDK installation, which is the variable value of JAVA_HOME

Find the picture in the menu bar in unity


Then switch the platform to Android Android platform


Note that the third step needs to set several places

Click Player settings to modify the com.Company.ProductName in the Bundle Identifier under Other Settings to be your own custom, for example: com.Test.test01.


Select the Android version in Other Settings, the version cannot be lower than your own mobile phone version.


After the setting is completed, click on the fourth step above to generate an Android apk

Send the generated apk file to your phone and you are ready to use it!


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325602485&siteId=291194637