Build your Unity game on an Android Device

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. 

Important Details

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

 

Export to Android Studio

If you choose to export to Android Studio, make sure to click on Export Project.

70788168.png


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.

Important: AndroidManifest Requirements

  • The application needs to set the attribute isGame to false or completely remove the attribute.
  • The main activity's launchMode should be assigned as singleTop
  • The main activity should have the following

android:alwaysRetainTaskState="true"
android:clearTaskOnLaunch="false"

Example:

<application android:isGame="false">
    <activity 
        android:launchMode="singleTop"
        android:clearTaskOnLaunch="false"
        android:alwaysRetainTaskState="true">
    </activity>
</application>

We’re always here to help. Contact integrations@skillz.com if you run into any issues.