These instructions were found here originally, and are slightly modified to solve some more errors.
1. Support the back button
Check the snippet here.
2. Export your project
- Go into ‘Build Settings’ and switch to Android. Change the Texture to ETC2, and make sure the build system is set to ‘Gradle’.
- Open the ‘Player settings’ from that screen and set the Bundle Identifier to the package name you desire.
- Note that this will probably not save (at least it doesn’t in the current version,
2018.2.2f1) so you will need to edit it again later.
3. Open the exported project in Android Studio
Don’t import it into a new project as said in the Medium post, just open the project.
- Modify the
AndroidManifest.xmland remove the IntentFilter. Otherwise you wil end up with a second launcher icon for your app.
- Change the application into a library by editing the
build.gradlefile. Switch this:
apply plugin: 'com.android.application'
apply plugin: 'com.android.library'
- Remove the line with
applicationIdfrom the gradle file, as libraries can’t specify an application id.
- If the ‘Bundle Identifier’ was not saved in the previous section, edit it now. You should modify the
AndroidManfiest.xmland the folder structure.
4. Integrate the library in your project
- Choose ‘Rebuild project’ in Android Studio to build the library.
- Pick the file from
- In your other app, choose File > New Module > Import JAR/AAR package and select your .aar file.
- Edit the
settings.gradleto include your new module.
- Edit the
build.gradle1of your main module to reference the new module:
implementation project(":your_aar_file_name")(inside the
- Add the Unity Activity to the manifest. It is called
<activity android:name="com.pixplicity.demo.augmentedimage.UnityPlayerActivity" />
- Launch the new Activity from your app using this snippet.
5. (Optional) disable it for non-ARCore devices.
Follow the steps described here