Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Plugins with resources: Jar, AAR, or Android library project (Unity 5+)?

Discussion in 'Android' started by eppz, Mar 7, 2016.

  1. eppz

    eppz

    Joined:
    Aug 2, 2014
    Posts:
    172
    Hi, I'm using features in my pluigin that needs resources res folder and some entries in AndroidManifest.xml. How should I include my library?

    I tried to extract JAR from build/intermediates: Unity builds the classes, but no resources.
    Now I'm just attached the Android project (the entire project, then the module folder only), but none of my classes, nor manifest entries did not get built (I'm checking `StagingArea` after build). I can run the app, but runtime can't find my classes.

    Anyone with similar issues? How to resolve?

    Maybe it is the folder layout? The project is EPPZ_Photos_Android, the module is EPPZ_Photos_Fragment.
    eppz.plugins.EPPZ_Photos_Fragment.png
     
    Last edited: Mar 8, 2016
  2. eppz

    eppz

    Joined:
    Aug 2, 2014
    Posts:
    172
    AAR.
     
  3. habilal

    habilal

    Joined:
    Apr 22, 2016
    Posts:
    2
    How can i add aar file in unity project? I have a aar file [java classes + resources]. In resources layout, I used FloatingActionButton property Fabszie in this widget. When I compile my code and deploy on device it becomes error.

    the error is: error: No resource identifier found for attribute 'fabSize' in package

    I placed my aar file in root/Assests/plugin/Android/myaarfile.aar.

    kindly help me out this problem.
     
  4. eppz

    eppz

    Joined:
    Aug 2, 2014
    Posts:
    172
    Sounds like an Android error, have nothing to do with Unity I think. A resource called "fabSize" should be present in the build.

    Should improve your debugging: you can always inspect the resulting APK content in Temp/StagingArea, so you can see if the resource is present. Or even better, setup an Android Studio Library project for the plugin itself (more on Unity Android plugin tutorial (2/3) Project setup and workflow).
     
    Last edited: Apr 27, 2016
  5. iamsidv

    iamsidv

    Joined:
    Jan 24, 2013
    Posts:
    17
    If I extend my Native Bridge class with AppCompatActivity, then I get a Class Not Found Exception. Have you faced this issue yet?