Unity - Android without Gradle

** These are instructions for configuration of our plugin on legacy systems (not using Gradle). Please see our main Unity documentation for a more up to date build process **

Please follow the instructions for the initial setup. This will pull in the library files but the SDK will still need to be configured as follows:

Build the Configuration JAR

  • Open the UnityAndroid project, from the Legacy directory, in your Eclipse IDE
    • New "Android Project from Existing Code"
  • Edit the UnityApplication.java file in this project:
    • This file contains all the configuration options that are required for the SDK
      • If you already have a project that you build to configure the plugins in your app then the configuration can be copied from here into the Application class in that project (not an Activity class)
      • If you do not already have an Application class in that configuration project, this file can be copied over to the project in order to add the xtremepush configuration options 
    • Swap in your real xtremepush app key and GCM sender id
    • Configure any other options required in the PushConnector initialization
    • If you require a callback to a C# function when a message is opened please edit the messageResponseReceived() function as necessary
  • Export the project as a jar file
    • In Eclipse, this can be built by right clicking on the project and selecting "Export..."
    • On the following screen, select "Java" -> "JAR file" and click "Next >"


    • On the following screen, expand your project and unselect everything in it apart from the "AndroidManifest.xml" file  and the "src" folder as seen below
      • Additionally, the checkbox to compress the contents of the JAR file can be selected
      • Note your export destination and then click "Finish"


Copy the Library Files into Unity Project

  • Copy all AAR and JAR files from the Legacy/Assets/Plugins/Android directory to the Assets/Plugins/Android folder in your Unity project
  • Copy the newly created JAR file from your export destination to the Assets/Plugins/Android folder in your Unity project
  • Delete the unityapplication-debug.aar from the Assets/Plugins/Android folder in your Unity project if you copied it in as part of this installation

Generate and Edit the AndroidManifest.xml File

  • In the Unity Build Settings, the Build System for Android should be set to Internal (Default)
  • Build the Unity project from the Unity IDE for Android
    • This will create an AndroidManifest-main.xml file in the Temp/StagingArea folder in your Unity project
  • Copy the AndroidManifest-main.xml to the Assets/Plugins/Android folder in your Unity project
  • Rename the file in Assets/Plugins/Android from AndroidManifest-main.xml to AndroidManifest-main.xml
  • We require one change in this file so open the file in a text editor and add the "android:name" attribute to the application element to link in the Application class from your JAR file above, as seen underlined here:
    • <application android:theme="@style/UnityThemeSelector" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true" android:name="UnityApplication">

This completes the Android configuration for apps that are not using a Gradle build-chain.

Have more questions? Submit a request


Article is closed for comments.