The general process is divided into the following six steps:
1. Install java_jdk
2. Configure java environment variables
3. Update the android sdk
4. Release the apk file from Unity3d
5. Create and run the android Virtual Machine
6. Install the apk file on the android virtual machine.
(For the convenience of beginners, I will give you a detailed description of the specific operations and possible problems in each step)
1. Install java_jdk
Official website (www.java.com.pdf, for free, the name of the file I installed is jdk-7u10-windows-i586.exe. The version is new and old. The version you downloaded may be different from me;
2. Configure java environment variables
Right-click my computer → properties → advanced system settings → advanced → environment variables, and click Create in the following system variables
Input variable name JAVA_HOME
The input variable value is the installation path of java_jdk in the previous step. My variable value is C: \ Program Files (x86) \ Java \ jdk1.7.0 _ 10
Click OK;
Create a new variable named CLASSPATH. The variable value is as follows:
.; % JAVA_HOME % \ lib \ tools. jar; % JAVA_HOME % \ lib \ dt. jar; % JAVA_HOME % \ bin
(Do not drop the previous point.) The relative path is used here, so you can copy my point and click OK;
Find an existing system variable Path and edit its value. Do not change the original content. Add
; C: \ Program Files (x86) \ Java \ jdk1.7.0 _ 10 \ bin
(Note that this is based on your java_jdk. It must be the same as what I wrote)
So far, java environment variable configuration has ended;
3. Update the android sdk
Run the sdk Manager.exe In the android SDK folder to update your desired android version as needed;
4. Release the apk file from Unity3d
Before building, make necessary Settings in Player Settings. The following are required:
① The Company in com. Company. ProductName in Bundle Identifier * must be changed to another name.
② Set the Install Location to Automatic. Otherwise, the running fails in the android virtual machine, and the message "Unfortunately, *** has stopped." appears, as shown in figure
③ The android version in the Minimum API level must be lower than or equal to the android version in the android virtual machine you want to create
The first Build will prompt you to select the path of the android sdk. Be sure to select the sdk level (my "E: \ Tools \ Android \ adt-bundle-windows-x86 \ sdk ");
5. Create and run the android Virtual Machine
Run AVD Manager.exe In the android sdk folder and click New... button to create a virtual machine. Fill in various Options, which is relatively simple. Note that you must check the Use Host GPU in Emulation Options; otherwise, an error will be reported when installing the apk file in the virtual machine, prompt "failure install _Failed_ Container_error ";
After creating a virtual machine, you must run the virtual machine before installing the apk file;
6. Install the apk file on the android virtual machine.
Move the published apk file to the platform-tools Folder In the android sdk path, open the cmd console, and first go to the platform-tools path in the android sdk path, command is "cd + specific path", my is "cd E: \ Tools \ Android \ adt-bundle-windows-x86 \ sdk \ platform-tools", and then press ENTER;
Enter the adb install + apk file name, and press enter to wait for a while. If the installation is successful, the system prompts success, as shown in figure
Then, find your apk in the Virtual Machine and play it. (My Own is attached below)