Local aar file reference

Source: Internet
Author: User

Local aar file reference

Sometimes you need to use a third-party aar library, or the source code of the Project is getting bigger and bigger. The division of labor in the project needs to be referenced or for modular purposes.

Arr is like a static library in C/C ++.

There are many online articles on how to create an aar. I will not repeat it here.

The most common way to use gradle is to upload the aar to mavenCentral or jcenter. To reference a local aar, add the following to the module configuration file build. gradle of the project:

Repositories {flatDir {dirs 'libs' // this way we can find the. aar file in libs folder }}
Then add the aar file to the libs directory and add it to build. gradle:
Dependencies {compile (name: 'mylib-debug', ext: 'aar ')}
It indicates that the mylib-debug.aar is referenced, and it is interesting that if the class in the test project import or use the mylib-debug.aar, compilation will not report an error, which is great!

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.