How to make JAR package in Android Studio

For the library-type Moudle in Android Studio, the AAR package is typed by default,
but sometimes our SDK needs to be shared with some other eclipse projects, so we need to output the JAR package, which
can be passed through the build. Gradle adds tasks to achieve

task makeJar (type: Copy) {
    delete 'build/libs/mysdk.jar'
    from('build/intermediates/bundles/release/')
    into('build/libs/')
    include('classes.jar')
    rename ('classes.jar', 'mysdk.jar')
}

makeJar.dependsOn (build)

Execute the generated JAR package in the terminal
./gradview makeJar

The JAR package we generated can be found in the following directory

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327009532&siteId=291194637