Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unable to find aar

Discussion in 'Android' started by push-pop, Jul 21, 2020.

  1. push-pop

    push-pop

    Joined:
    Jun 29, 2017
    Posts:
    28
    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:

    Code (JavaScript):
    1. dependencies {
    2.     implementation fileTree(dir: 'libs', include: ['*.jar'])
    3.     implementation(name: 'libraryname-debug', ext:'aar')
    4. }
    When I run the build, I see the following line in logcat:

    Code (JavaScript):
    1. E/Unity: Unable to find libraryname-debug
    the only other error I see is:

    Code (JavaScript):
    1. 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!
     
    Last edited: Jul 21, 2020
  2. push-pop

    push-pop

    Joined:
    Jun 29, 2017
    Posts:
    28
    Just added this line to AndroidManifest.xml after reading this stackoverflow post.

    Code (JavaScript):
    1. <uses-library android:name="libraryname-debug" android:required="true"/>
    Now when I try to build I get:

    Code (JavaScript):
    1. Installation did not succeed.
    2. The application could not be installed: INSTALL_FAILED_MISSING_SHARED_LIBRARY
    3. Installation failed due to: 'null'
     
  3. push-pop

    push-pop

    Joined:
    Jun 29, 2017
    Posts:
    28
    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:
    Code (CSharp):
    1. E/Unity: Unable to find libraryname-debug
    as if Unity is still looking for the debug version.

    UnityLibrary gradle:

    Code (CSharp):
    1. dependencies {
    2.     implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
    3.     implementation(name: 'libraryname-release', ext:'aar')
    4. }
    5.  
     
  4. push-pop

    push-pop

    Joined:
    Jun 29, 2017
    Posts:
    28
    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?
     
  5. push-pop

    push-pop

    Joined:
    Jun 29, 2017
    Posts:
    28
    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.
     
    visionnaireMedia likes this.
  6. jacksonkr

    jacksonkr

    Joined:
    Jan 22, 2013
    Posts:
    22
    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