Configuration
Android Configuration
Export to Native
It's advised to maintain separate version control for the exported project so you can be aware of what changes being made by the next export attempt and to ensure that the changes from this documentation remain intact.
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
.

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

Open Exported Project
Please open ExportedAndroidNative
with Android Studio.

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

If you encounter any Gradle issues, please fix them before continuing to the next step.
Automated Post-Export Android Adjustment
This automation tool only works for the old Gradle version like v6.1.1.
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>
If you prefer manual adjustment, please continue to read Manual Android Native Adjustment.
Manual Android Native Adjustment
Configurations and Build Dependencies
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-->
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
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
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
Add
google-services.json
tolauncher
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
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
iOS Configuration
Add the file
NoctuaGame.cs
or your script into your Assets unity project. You can downloadNoctuaGame.cs
here

Add
UnitySendMessage
andSend_Message
to Scripting Define Symbols like the picture below.

Export To Native

Add
NoctuaConnector.h
andNoctuaConnector.mm
to the Classes directory. Calling the SDK interface in Unity will eventually call the corresponding OC interface inNoctuaConnector.mm .
You can downloadNoctuaConnector
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
Last updated