Android Studio3.0 references the nature of the module and shares the module to other module

Source: Internet
Author: User

How do I refer to another module in the module?

Method One:

Google provides its own reliance, compile introduction needs to use the module.

Method Two:

Each module will eventually be compiled into a corresponding suffix for the Aar file < \modulename\build\outputs\aar\xxx.aar>, refer to this file directly in the module you need to use. The introduction of the Aar file here is slightly different from the direct reference module, as follows:

The first step: you need to first add the following code under android{} under Build.gradle in the host module:

Repositories {    Flatdir {        ' libs '    }}

Step Two: Add Dependencies

Compile (name: ' Aarname ', ext: ' AAR ')

How the jar files in the outer module are used in the host module?< only describes the solutions on Android studio3.0 >

Compile is a way that Google offers to introduce external class libraries before Android Studio 3.0. After Android studio3.0 compile was replaced by implementation and API in two ways.

Implementation: If you are importing a jar file under a local libs file, it means that the jar file is only available in the current module and cannot be used directly from the externally referenced module.

API: If you are importing a jar file under a local libs file, it means that the jar file can be used not only in the current module, but also externally referenced by the module.

Compile only: As the name implies, it is not packaged into the apk when it is actually packaged.

Runtime only: Packaged in the APK, not compiled (feel useless)

Nothing else to say .....

  

Android Studio3.0 references the nature of the module and shares the module to other module

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.