Create Aar File in Android Studio

Create aar file in Android Studio

If your library is set up as an Android library (i.e. it uses the apply plugin: 'com.android.library' statement in its build.gradle file), it will output an .aar when it's built. It will show up in the build/outputs/aar/ directory in your module's directory.

You can choose the "Android Library" type in File > New Module to create a new Android Library.

If you are still not seeing your aar file, select Build > Rebuild Project.

How to create new Android AAR in Android Studio

After days of unsuccessful head-banging with the IDE, I found an astoundingly simple solution in some Google results, namely:

  1. Manually edit project/app/build.gradle
  2. Change apply plugin: 'com.android.application' to apply plugin: 'com.android.library'
  3. Remove the line specifying applicationId.
  4. Build->Clean Project and Build->Rebuild Project.

Voila! New library app-debug.aar appears in project/app/build/outputs/aar/

I don't know where the name app-debug came from, but you can rename it afterwards if you like.

UPDATE 7/2/18

I omitted precursor steps to this procedure. They are

1. Create a base project however you normally do.

2. Delete classes and other stuff you don't need in the aar.

3. Follow the steps above.

How to build AAR from Android Library?

Referencing Create aar file in Android Studio, try to simply Build > Rebuild project. AAR file should appear in ~/Source/BluePlayer/bfsdk/build/outputs/aar

How to create *.aar file from existing android studio project ( Not creating new android library)?

I did what morrison said I got that error which i sent as photo
the solution for that error was just to "Rebuilt project" after "File/Sync project ..."
( which is funny :) )

now I have aar file in my app/build/...

result as *.aar

Export Android Library as AAR file

You should do it using gradle. Just follow these steps and you will get .aar file:

1) At right side of your android studio there is a pane name Gradle. Open it and then do open library portion and run assemble. Like in the picture below.

Sample Image

2) When it is successfully ran just go to your library folder and you will find your .aar files there.

C:\projectPath\libraryPath\build\outputs\aar

Android Studio Create AAR using another AAR file and jar inside

Use android-fat-aar gradle plugin, it is super usefull!



Related Topics



Leave a reply



Submit