android-studioaar

How to import .AAR module on Android Studio 4.2


Previously I used File > New > New Module > Import .JAR/.AAR Package

but the option to Import .JAR/.AAR Package from the New Module wizard has been removed on Android Studio 4.2 and following the document which suggests using the Project Structure Dialog reveals no clear answer for importing .AAR module and seems to be outdated

I tried adding the module as a dependency in the project Structure but it did not work


Solution

  • From Android Studio package manager select project:

    enter image description here

    Then make a new directory in project level named libs

    enter image description here

    enter image description here

    Now right click the libs and select Reveal in finder and then paste here your .aar file.

    enter image description here enter image description here

    Now in Build.gradle(Module) add the following implementation.

    implementation files('../libs/testaarfile.aar') 
    

    and snyc your project.