Hi I'm a new in Android development and using Android studio. I need to create *.aar lib. I created New Android library project (empty for now). How to generate *.aar file from it? Can you explain by steps? Has read a lot of topics but still unsuccessful. Thanks.
Asked
Active
Viewed 5,389 times
2
-
do you have build/outputs folder? – pskink Nov 26 '14 at 12:14
-
How to check or how to configure it? Sorry but I'm new in it. – Simcha Nov 26 '14 at 12:20
-
possible duplicate of [Create aar file in Android Studio](http://stackoverflow.com/questions/24309950/create-aar-file-in-android-studio) – MihaiC Nov 26 '14 at 12:21
-
What to check? Check if you have folder in your project tree? – pskink Nov 26 '14 at 12:22
-
@MihaiC I read it but didn't understand... – Simcha Nov 26 '14 at 12:23
-
@pskink I added image of my tree (so I think I don't) – Simcha Nov 26 '14 at 12:31
-
Is there any aar file in the build folder? – pskink Nov 26 '14 at 12:34
-
@pskink nope. It's clean. – Simcha Nov 26 '14 at 12:35
-
1So build your project – pskink Nov 26 '14 at 12:36
-
1Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/65689/discussion-between-simha-and-pskink). – Simcha Nov 26 '14 at 12:37
2 Answers
4
Here's what has worked for me.
on the command line go to the root directory of the project
ensure that your JAVA_HOME environment variable points to the version of the java sdk you are going to use. On a Mac via the bash shell that would look something like this:
export JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home'
(click here to find out how to find your Java Home)
- To clean type ./gradlew clean
- To build the library type ./gradlew aR (This may take a while)
You should now find the .aar file in mymodulename/build/outputs/aar
Thanks to geekgarage for clarification.

Community
- 1
- 1

Noah Ternullo
- 677
- 6
- 16
1
Thanks for @pskink, found out, need to build it like: "gradlew assemble" from the root of project.

Simcha
- 3,300
- 7
- 29
- 42