2

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.

enter image description here

Simcha
  • 3,300
  • 7
  • 29
  • 42

2 Answers2

4

Here's what has worked for me.

  1. on the command line go to the root directory of the project

  2. 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)

  1. To clean type ./gradlew clean
  2. 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