33

I have create a very simple 'Android Library' module with only one class which builds fine in debug releasing build/output/library-debug.aar

But, when I switch to release, even though it says build successful, the aar is not there.

The Android Studio project only has this library module.

Thanks for advance.

Abdalla
  • 2,071
  • 2
  • 16
  • 27

7 Answers7

86

To get the aar, you can do the following

1) “View/Tool Windows/Gradle”, to open the gradle window

2) From gradle window, run assembly Gradle task by double-click on My_Plugin_Android/:My_Plugin/Tasks/build/assemble

Then the release and debug aars are outputed.

Abdalla
  • 2,071
  • 2
  • 16
  • 27
  • 4
    Amazing! Thank you! This answer needs to be higher in Google search results. I had a similar issue with Android Studio 3.0, where an app converted to a library would not output any .aar. Build > Build APK(s) would do *nothing*, not even output any form of error message ; and command line gradlew (4.2.1 on MacOS High Sierra) would give me "env: bash\r: No such file or directory"... probably a windows-to-mac issue... – antho Nov 15 '17 at 22:41
  • 1
    Still no aar directory in outputs directory :( – Tony Chen Dec 02 '18 at 01:25
  • 1
    OK it works! The aar file is under module folder, not app folder. My bad :P – Tony Chen Dec 02 '18 at 02:06
  • Absolutely classic beginner's problem solved, thank you! – user1725145 May 29 '19 at 15:03
  • 'assemble' produced nothing in my studio, but 'bundle' target did the production – Shimbawa Oct 19 '19 at 17:44
  • in my case it was "assembleRelease" the only way to output the aars – Lotan Feb 02 '20 at 20:38
24

Here are the steps:

Step1: In Android studio open 'gradle' window.
Step2: Select your library from the gradles projects
Step3: Click on Tasks => build => assemble

The aar file will be generated in 'build/outputs' folder in finder window.

GvSharma
  • 2,632
  • 1
  • 24
  • 30
2

Ensure that the following line is there in your build.gradle file

apply plugin: 'com.android.library'
  • Open gradle window in android studio (Look at right top corner)
  • Double click on Library => Tasks => build => assemble
Codemaker2015
  • 12,190
  • 6
  • 97
  • 81
1

From Gradle > select your project > Tasks > Build > build dependents

As shown in below image :

enter image description here

parul
  • 363
  • 1
  • 6
  • 16
1
  1. Click build -> selcet build Variant menu
  2. Select release in Bulid Variants panel
  3. Click build -> Rebuild project menu
  4. Open folder: <project_name>/<module_name>/build/outputs/aar

You can find release aar.

excing
  • 55
  • 6
0

Set up your project as an Android library.
In build.gradle file: plugin: 'com.android.library'
You can see the output in: build/outputs/aar/[your module].

Read this article about your problem.

0

In build.gradle:MyModule

plugins {
    id 'com.android.library'
}

Remove android -> defaultConfig -> applicationId if it was attached.

Sync and build from Gradle task menu

freezing_
  • 984
  • 1
  • 9
  • 13