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.

Unity does not recognize Android plugin Library if it is not inside the Plugins/Android folder

Discussion in 'Android' started by menar555, Nov 4, 2019.

  1. menar555

    menar555

    Joined:
    Dec 1, 2016
    Posts:
    3
    Hello!

    I've got "Plugin A" inside Plugins/Android folder and "Plugin B" plugins inside Libs/Plugins/Android folder. All plugin folders (A, B) contains AndroidManifest.xml and project.properties.

    After build in generated gradle project i see "Plugin A", but dont see "Plugin B". If i move "Plugin B" to Plugin/Android folder, after build i see it in generated gradle project.

    Strange thing that .aar files are included from anywhere in the project.

    Is it right behaviour of building android plugins?
    P.S. I need "Plugin B" to be in Libs folder because this folder will be shared to another project.
     
  2. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    824
    That is the expected behaviour in current Unity versions. You can see it in official documentation: https://docs.unity3d.com/Manual/AndroidAARPlugins.html
    However in Unity 2020.1 to import Android library, users will have to add .androidlib at the end of the directory name (like a fake extension) and then the Android library could be placed anywhere in the project, just like .aar plugins right now.
     
  3. menar555

    menar555

    Joined:
    Dec 1, 2016
    Posts:
    3
    Thank you for your reply! I understand how it must work now.

    Yes, it will be great if android library could be placed anywhere. We will be waiting for the update.
     
  4. andrea_chua

    andrea_chua

    Joined:
    Mar 16, 2020
    Posts:
    1
    But the system seems to ignore all the dependencies required by library using the .androidlib method?
    We basically copied the whole module created by android studio into assets and add the extension to the folder name.
     
  5. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,891
    Can you please let us know from when .androidlib is being supported? This makes us to have better backward compatibility plugins as an asset store publisher. Else, we need to have separate packages for 2020 which is not a good option!
     
    Last edited: Apr 20, 2020
  6. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    824
    For publishing plugins it's strongly recommended to use .aar format instead of publishing separate files (directory). If you follow that, then you don't have to worry about the naming. The behaviour mentioned previously is only available since 2020.1, however it's just a directory name, so if you place this directory in Plugins/Android in older Unity versions it should still work fine.
     
    nasos_333 likes this.
  7. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,891
    Oh great! Thanks for confirming.
     
  8. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,036
    Hi,

    Can we copy the .aar in any folder ? Because the link says "To add an AAR plug-in to your Project, copy the .aar file anywhere within the Assets/Plugins/Android/libs path"

    Also i had a project in unity 2018 and now not working in 2019, because when i run the builder (BuildPipeline.BuildPlayer), it does not create the "src"folder in the Gradle project root, but defaults always to puting the src in unityLibrary named folder, is this also a new behavior ?

    Should i manually place "src"outside the folder just before i continue with my code ? Would this work, of the unityLibrary name is now mandatory ?

    Thanks for any insight on those
     
    Last edited: Sep 12, 2020