I am trying to create an Andoid AAR library to contain commonly used utility functions. I followed the instructions in https://developer.android.com/studio/projects/android-library
exactly. Namely:
1. File->New->New Module
2. Click "Android Library" then Next
3. Tried to use defaults: "My Library", "mylibrary" and SDK Version, but Finish button is grayed out and error message appeared: "The module location is inside Studio's install location."
I see no place to enter a module's location. I've tried variations on Libray name and Module name with no joy.
Am I doing something wrong?
Asked
Active
Viewed 4,665 times
2

DontPanic
- 2,164
- 5
- 29
- 56
-
The link you provided is about creating projects as libraries modules for your main app, to generate an aar you should look something else – Marcos Vasconcelos Jun 29 '18 at 18:03
-
1"to generate an aar you should look something else"? Hardly a useful suggestion. If you have a concrete positive suggestion, I would love to hear it. – DontPanic Jun 30 '18 at 14:49
2 Answers
3
After days of unsuccessful head-banging with the IDE, I found an astoundingly simple solution in some Google results, namely:
- Manually edit project/app/build.gradle
- Change apply plugin: 'com.android.application' to apply plugin: 'com.android.library'
- Remove the line specifying applicationId.
- 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.

DontPanic
- 2,164
- 5
- 29
- 56
-1
you are able to use command line tool to create .aar
file
./gradlew <moduleName>:assemble

yoAlex5
- 29,217
- 8
- 193
- 205