Configuration

Android Configuration

Export to Native

Now you can export to Android Native. Go to File > Build Settings. Select Android in the Platform list, then check the Export Project's checkbox. Then click the Export button.

You will be asked to select a folder before the compiling process starts. Please create one and select it. For this example walkthrough, we named it ExportedAndroidNative.

Build Settings

Now you have a folder that contains a complete Android Native project.

Folder Android Native Project

Open Exported Project

Please open ExportedAndroidNative with Android Studio.

Open Exported Project

If there is SDK difference between the Android Studio's SDK and the project's SDK, please select Use Project's SDK.

Project's warning

Automated Post-Export Android Adjustment

Download link: https://github.com/NoctuaLabs/noctua-android-sdk/releases

We have provided a tool to ease the integration steps after export in Windows PC. It could automate all the adjustment below in one key strike. The usage is pretty straightforward:

C:\Users\foobar>postexport.exe ..\UnitySDKTest_Exported

NoctuaGG Unity Post-Export script started...
Path exists: C:\Users\foobar\src\UnitySDKTest_Exported\unityLibrary\build.gradle
Path exists: C:\Users\foobar\src\UnitySDKTest_Exported\launcher\build.gradle
A valid exported Android project directory found.

Checking and fixing dependencies...C:\Users\foobar\src\UnitySDKTest_Exported
removeGeneratedByUnityLines...
removeGeneratedByUnityLines done.
updateGradleDependencies...
updateGradleDependencies done.
addGoogleServicesPlugin...
addGoogleServicesPlugin done.
addGoogleServicesClasspath...
Found different version of google-services classpath. Replacing with: classpath 'com.google.gms:google-services:4.2.0'
addGoogleServicesClasspath done.
Checking configuration files...C:\Users\foobar\src\UnitySDKTest_Exported
Path exists: C:\Users\foobar\src\UnitySDKTest_Exported\launcher\google-services.json

Your exported project is configured properly.
Please restart Android Studio through File > Invalidate Cache / Restart, then click Invalidate and Restart.

C:\Users\foobar\src\noctuagg-unity-postexport>

Manual Android Native Adjustment

Configurations and Build Dependencies

  1. Find all AndroidManifest.xml files in the project and remove this line within the file, if any.

<!-- GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN-->
  1. Add additional dependencies to build.gradle (Module: unityLibrary):

implementation 'androidx.appcompat:appcompat:1.6.1' // If you get error that related to androidx-core, please downgrade to '1.0.0-beta01'
implementation 'com.github.bumptech.glide:glide:4.11.0'
//Google Payment
implementation 'com.android.billingclient:billing:7.0.0'
//Firebase
implementation 'com.google.firebase:firebase-analytics:20.1.1'
//Adjust
implementation 'com.adjust.sdk:adjust-android:4.31.1'
implementation 'com.android.installreferrer:installreferrer:2.2'
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.1'
//Facebook
implementation 'com.facebook.android:facebook-android-sdk:14.1.0'

Also remove this line:

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
  1. Add this to build.gradle (Module: launcher):

apply plugin: 'com.google.gms.google-services'

Also remove this line:

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
  1. Add this to build.gradle (Project: AndroidBuild):

classpath 'com.google.gms:google-services:4.3.14'

Also remove this line:

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
  1. Add google-services.json to launcher directory.

Then restart Android Studio through File > Invalidate Cache / Restart, then click Invalidate and Restart. The Android Studio should be restarted and all Gradle tasks are resolved.

SDK's Java Class

Download Noctua's Java class files from this link: https://github.com/NoctuaLabs/noctua-android-sdk/tree/main/interface

Then add them to unityLibrary\src\main\java\com\noctua. Create the directory if it does not exist.

Change main launcher to your MainActivity.java like this

Configure

Then please follow the steps in this guide to configure

Configuration

Jump to the "Update Your Manifest", "SDK Checker for Debugging", and "Event Mapping" sections.

iOS Configuration

  • Add the file NoctuaGame.cs or your script into your Assets unity project. You can download NoctuaGame.cs here

  • Add UnitySendMessage and Send_Message to Scripting Define Symbols like the picture below.

  • Export To Native

  • Add NoctuaConnector.h and NoctuaConnector.mm to the Classes directory. Calling the SDK interface in Unity will eventually call the corresponding OC interface in NoctuaConnector.mm . You can download NoctuaConnector here

  • The developer needs to specify the specific object of the callback result to notify Unity and the specific method of the notification object

Configure

Then please follow the steps in this guide to configure

Configuration

Jump to the "Update Your Manifest", "SDK Checker for Debugging", and "Event Mapping" sections.

Last updated