This article will teach you how to build directly on a device and how to export your project to Android Studio. Please refer to this article to learn how to build your game on a device via Xcode.
When you generated a SkillzDelegate game object by pressing Skillz -> Generate Delegate, this also generated your Android Manifest and Build.gradle file which are stored in Assets/Plugins/Android. Feel free to customize these files based on your needs.
When building an Android Studio project or building an apk directly to a device, you’ll need to change the permissions folder of Unity’s gradle version so that our Android Build Process can update your gradle version temporarily. In order to do this, open your terminal and perform the following command:
sudo chmod -R 757 /Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/gradle
Build directly to your device from Unity
After plugging in your Android device to your laptop. Click on File -> Build Settings -> Android -> Build and Run. Make sure Build System is in "Gradle". If you are using other 3rd party frameworks besides Skillz, and these frameworks need to modify both your Manifest and Build.gradle file, you may need to export to Android Studio.
Note: If you see the following pop-up,
You’ll need to specify in Unity which path your Android SDK lives in. You can do this by going to Unity -> Preferences and then specifying the paths like so:
If you are missing either the Android SDK and JDK, you can download the missing asset by clicking the corresponding “Download” button and following their instructions.
Export to Android Studio
If you choose to export to Android Studio, make sure to click on Export Project.
Then, in Android Studio, go to File -> New -> Import Project and select the exported directory. Your Android studio project will still contain the Android Manifest and build.gradle files that were inside Assets/Plugins/Android of your Unity project. Perform any changes you wish to make and you should now be able to build on a device.
We’re always here to help. Contact email@example.com if you run into any issues.