This article describes the steps to build a ** Android ** development environment with ** Unity2018 **.
I wrote this because I learned that Android Build Support alone cannot build ** .apk
**.
We have confirmed the operation in the following environment.
Download the JDK (Java Development Kit) from the official Oracle website. http://www.oracle.com/technetwork/java/javase/downloads/index.html
Run the downloaded exe with administrator privileges to install it. Make a note of the folder where you installed the JDK.
Pass the path ** JAVA_HOME ** for use with Unity.
Control Panel> System and Security> System
Click Advanced System Settings from to open the system properties.
** Environment Variables> System Variables> New
**
--Variable name: JAVA_HOME
--Value: Folder where you installed the JDK
Set to.
At this point, restart your PC once.
Then download and install Android Studio. https://developer.android.com/studio/?hl=ja
The reason for downloading the entire Android Studio instead of the SDK alone is This is because Android Studio comes with ** Android SDK Manager **.
If you want to check the operation on the actual smartphone, launch Android Stuido and
Click Configure> SDK Manager
at the bottom right of the screen and install the one that corresponds to your device's OS.
You can find the Android SDK path in the SDK Manager.
Launch Unity Hub and open the Install tab.
Click ...
for the version of Unity to which you want to add Android Build Support.
Select Add Component for modal display.
Check Android Build Support in Platforms and click Done. The download and installation will start, so wait until it finishes.
.apk
file **Launch the Unity project.
First, pass the JDK and Android SDK paths through Unity. Open Unity Preference from ʻEdit> Preference`. Open the Extra tools tab and set the respective paths for the Android JDK and SDK.
If the environment variables are set properly, pressing the Browse button will Select Yes when Unity asks if you want to set a default path. If you are not asked, set the path confirmed in ** 1. Install JDK ** and ** 2. Install Android Studio **.
Then open File> Build Setting
.
Select Android in Platform and click Switch Platform.
Click Player Setting to the right of Switch Platform. The Inspector will open, so set the Package Name in Other Settings. If you leave the default, the build will fail.
Let's actually build it.
Build Setting Click the Build button at the bottom right.
You can choose the output folder and the .apk
file name as you like.
It will take some time, so wait until the build is complete.
To build a ** .apk
** file in Unity for Android devices
You need ** JDK ** and ** Android SDK ** in addition to ** Android Build Support **.
Recommended Posts