引用

I wonder why there is no example of stand alone jar project.

In eclipse, we just check “Is Library” box in project setting dialog.
In Android studio, I followed this steps and got jar file.

1) Create a project.

2) open file in the left project menu.
Gradle Scripts >
build.gradle(Module: XXX)

3) change one line:
apply plugin: ‘com.android.application‘ -> apply plugin: ‘com.android.library

4) remove applicatioId in the file

applicationId "great.example.com.testproject"

5) build project
Build > ReBuild Project

6) then you can get aar file
app > build > outputs > aar folder

7) change aar file extension name into zip

8) unzip, and you can see classes.jar in the folder.
rename it, and use it!