Hi all,
I’ve been writing native libs for use with Unity on a current project. I have gotten the aar workflow to work nicely, in the past, however I am currently having issues with a new type of library I’m making.
Basically the issue is that Unity is not able to find the library at runtime. I exported the android project and the aar is in the filesystem in unityLibrary/libs which is where I think it should be. It is referenced in the gradle file like this:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation(name: 'libraryname-debug', ext:'aar')
}
When I run the build, I see the following line in logcat:
E/Unity: Unable to find libraryname-debug
the only other error I see is:
E/libprocessgroup: set_timerslack_ns write failed: Operation not permitted
which I don’t know if it is relevant.
The only difference in my current workflow is that this aar contains a service, and is built with an AIDL file. I am not sure if that changes things…
Any ideas how I can track down this issue??? Not seeing much help in the debug logs.
Thanks!
Just added this line to AndroidManifest.xml after reading this stackoverflow post.
<uses-library android:name="libraryname-debug" android:required="true"/>
Now when I try to build I get:
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_MISSING_SHARED_LIBRARY
Installation failed due to: 'null'
Ok this is strange…
I made a release build of my aar, because I was curious if the debug build was the issue…
However I still get the same error:E/Unity: Unable to find libraryname-debug
as if Unity is still looking for the debug version.
UnityLibrary gradle:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation(name: 'libraryname-release', ext:'aar')
}
Bump. Any ideas here? Can anyone at least confirm that it is possible to use an AAR containing a service within Unity? Anyone know how or if I need to include the AIDL file?
Alright well after getting annoyed and switching to a release lib, went ahead and closed Unity.
Booted up this morning and everything works fine.
Remember kids: 90% of Unity bugs can be solved by restarting Unity.
1 Like
You might also try build settings → Export (dropdown arrow) → Clean Build
BE WARNED
If you’ve customized your android files at all (xml, .java, etc) make sure to save an additional backup copy (or commit your work) before trying this