I have been given a Unity project, that is an AR game made to run on android. The app runs well with Build and Run directly from Unity, and if I export it as an android library and build using Android Studio, it also runs well. Unfortunately, the format of the exported library does not work for our intended use case; it creates a module named unityLibrary containing source and dependencies, but I want to provide unityLibrary as a package through artifactory, so I need to convert the unityLibrary module into an AAR. I can do this with the usual gradlew assemble
after a few minor modifications to the unityLibrary Manifest, and I can then include that AAR locally into a project by dropping it into the the project's libs
folder and then setting it as a project dependency using implementation(name: "unityLibrary-debug" ext: "aar")
.
The app mostly works at this point, but the AR parts of the game do not work, the camera feed is a completely black screen. In the adb logs there is the following error:
2020-05-27 01:53:55.667 8661-8744/com.mokriya.aarapp E/Unity: DllNotFoundException: Unable to load DLL 'UnityARCore': The specified module could not be found.
at UnityEngine.XR.ARCore.ARCoreSessionSubsystem+NativeApi.UnityARCore_session_construct (UnityEngine.XR.ARCore.ARCoreSessionSubsystem+NativeApi+CameraPermissionRequestProviderDelegate cameraPermissionRequestProvider) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.XR.ARCore.ARCoreSessionSubsystem+Provider..ctor (UnityEngine.XR.ARCore.ARCoreSessionSubsystem subsystem) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.XR.ARCore.ARCoreSessionSubsystem.CreateProvider () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.XR.ARSubsystems.XRSessionSubsystem..ctor () [0x00000] in <00000000000000000000000000000000>:0
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <00000000000000000000000000000000>:0
at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00000] in <0000000
2020-05-27 01:53:55.685 8661-8744/com.mokriya.aarapp E/Unity: DllNotFoundException: Unable to load DLL 'UnityARCore': The specified module could not be found.
at UnityEngine.XR.ARCore.ARCoreCameraSubsystem+NativeApi.UnityARCore_Camera_Construct (System.Int32 mainTexPropertyNameId) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.XR.ARCore.ARCoreCameraSubsystem.CreateProvider () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.XR.ARSubsystems.XRCameraSubsystem..ctor () [0x00000] in <00000000000000000000000000000000>:0
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <00000000000000000000000000000000>:0
at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.SubsystemDescriptor`1[TSubsystem].Create () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.XR.ARFoundation.SubsystemLifecycleManager`2[TSubsystem,TSubsystemDescriptor].CreateSubsystemIfNecessary () [0x
2020-05-27 01:53:55.759 8661-8744/com.mokriya.aarapp E/Unity: Unable to find FirebaseCppApp-6_12_0
2020-05-27 01:53:55.775 8661-8744/com.mokriya.aarapp E/Unity: DllNotFoundException: Unable to load DLL 'FirebaseCppApp-6_12_0': The specified module could not be found.
at Firebase.AppUtilPINVOKE+SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_AppUtil (Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate applicationDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate arithmeticDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate divideByZeroDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate indexOutOfRangeDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate invalidCastDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate invalidOperationDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate ioDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate nullReferenceDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate outOfMemoryDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate overflowDelegate
So, I don't understand why there should be any dependencies that aren't found at runtime when using an AAR, when those same dependencies are found with the library when it is given as a library module with source and dependencies. Does anyone have any ideas on why that might be? Or does anyone have tips on how I can troubleshoot this further?