[Android Studio] *. jar and *. aar generation and *. aar import Project Method

Source: Internet
Author: User

[Android Studio] *. jar and *. aar generation and *. aar import Project Method
This section describes how to generate an aar file in Android Studio and use the aar file locally. *. Jar and *. aar files are generated at the same time when you generate a self-built library in Android Studio. Storage locations:

 

Differences:

*. Jar: contains only class files and list files, excluding resource files, files, and other res files.

*. Aar: contains all resources, and all class and res resource files.

If you are just a simple class library, use the generated *. jar file. If you use a UI library that contains some control layout files and font and other resource files written by yourself, you can only use *. aar file.

 

Usage:

*. Jar: copy the file to the: libs directory. You can directly import the file to eclipse. Add the following to the AndroidStudio project:

?
1 2 3 Dependencies {compile fileTree (include: ['*. jar'], dir: 'libs ')}
Re-compile a project to complete the loading.

*. Aar: There are two methods: Local Loading and network loading. Since network loading involves publishing to mavenCentral hosting, we will not discuss it here. In addition, we will not discuss it if eclipse has not been used for a long time; this is a simple and fast local loading method.

The aar file demonstrated here is: "genius. aar"

Step 1: Copy to: libs directory

Step 2: change

?
1 2 3 4 5 6 7 8 Repositories {flatDir {dirs 'libs'} dependencies {compile (name: 'genius ', ext: 'aar ')}

Added "repositories" and changed "dependencies" respectively, and re-compiled the project to work properly.

Upload "file.

This is what Android Studio automatically parses the aar file.

Related Article

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.