简体   繁体   中英

Export Android Library as AAR file

I have created a library module in my project. Now, I want to share/publish this library with others. Sharing a.aar file would be fine for now.

I went through the article - https://developer.android.com/studio/projects/android-library and found the following options.

  1. When you want to build the AAR file, select the library module in the Project window and then click Build > Build APK .
  2. However, if you want to share your AAR file separately, you can find it in project-name/module-name/build/outputs/aar/ and you can regenerate it by clicking Build > Make Project .

I have tried these two options, but couldn't find /aar folder in the path project-name/module-name/build/outputs/

This is the first time I am building a library that needs to be shared with others.

Is there something else I need to do? Please share your thoughts.

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.

在此输入图像描述

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

You can try manually create.aar from command line

./gradlew <moduleName>:assemble

output is located

<project_path>/build/outputs/aar/<module_name>-<build_variant>.aar

[Read more]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM