0

I'm trying to create an Android library for two days already. Realy need your help. I have an existing App which I want to do as a Library.

According to Android developers documentation:

f you have an existing app module with all the code you want to reuse, you can turn it into a library module as follows:

Open the module-level build.gradle file. Delete the line for the applicationId. Only an Android app module can define this. At the top of the file, you should see the following: apply plugin: 'com.android.application' Change it to the following: apply plugin: 'com.android.library'

I have done this step. The next step is saying:

When you want to build the AAR file, select the library module in the Project window and then click Build > Build APK.

I don't really understand how to build the AAR file. Also in my library, I have others dependencies which I need to be in my Library.

I tried a lot of suggestions in StackOverflow but didn't find the answer.

Unfortunately, I didn't find a good example of creating an Android Library with dependencies.

Igor Fridman
  • 1,267
  • 1
  • 16
  • 30

1 Answers1

0

I don't really understand how to build the AAR file

Just compile the library or use ./gradlew build.
The output will be stored under the library's subdirectory under build/outputs/aar.

I have others dependencies which I need to be in my Library.

The aar file doesn't contain the transitive dependencies.
I suggest you publishing your library into a public or private maven repository.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841