How Android Studio hits the jar pack

Source: Internet
Author: User

How Android Studio hits the jar pack

In eclipse we know how to export a project as a jar package for use by other projects.
Can be processed by modifying gradle in as.
We create a new project Makejar, create a new modle-type for the library in the project

App for our main project, Librarydemo is the model that we want to generate the jar package for.
Add the following code to the Librarydemo:

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)//在终端执行生成JAR包// gradlew makeJar

Type Gradlew Makejar in terminal Enter to see OK as shown below:

Of course, in the main engineering app build to add Librarydemo this dependent model:

dependencies {    compile fileTree(dir‘libs‘, include: [‘*.jar‘])    ‘com.android.support:appcompat-v7:22.2.0‘    compile project(‘:librarydemo‘)}

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

How Android Studio hits the jar pack

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.