This document explains how to include our library consisting the games into a standard Android application through Activity.
Requirement:
Android Studio Bumblebee (2021.1.1) or later
STEPS:
Place our "Nx_UnityLibrary" folder in the same directory as the Native Android Project, then:
Open settings.gradle file
Add a new project pointing to unityLibrary module after the main app module: include ':unityLibrary' project(':unityLibrary').projectDir=new File('..\\Nx_UnityLibrary\\unityLibrary')
And add the following in dependencyResolutionManagement{repositories{ block: flatDir { dirs "${project(':unityLibrary').projectDir}/libs" }
Open build.gradle(Module: NativeAndroidApp.app) file
Add the following in dependencies{ block: implementation project(':unityLibrary') implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: ['*.jar'])
Copy the contents of the gradle.properties file from the exported Unity project root folder to the gradle.properties file in the native application root folder. Note: if you update the Unity project and re-export it again, make sure that the contents of the gradle.properties file in the exported project did not change. If they did - repeat this step.
Click Sync Now to do a project sync since Gradle files have been modified
Here is how the settings.gradle file should look.
Here is how the build.gradle(Module: NativeAndroidApp.app) file should look
If everything succeeds, you should see unityLibrary module added in Android view
Comentários