Android Studio Packaging Reference for AAR

Source: Internet
Author: User

Today, when compiling with Android Studio, we found an AAR package containing resource files and class files! A description of the AAR was then queried:

1.AAR description

Document address; Http://tools.android.com/tech-docs/new-build-system/aar-format

AAR formatthe ' AAR ' bundle is  theBinary distribution ofAn Android Library project.thefileExtension is. AAR, and  theMaven artifact type should be AAR asWell but  the fileitself a simple zipfile  with  theFollowing entries:/androidmanifest.xml (mandatory)/classes.jar (mandatory)/res/(mandatory)/r.txt (mandatory)/ assets/(optional)/libs/*.jar (optional)/jni/<abi>/*.so (optional)/proguard.txt (optional)/lint.jar (optional ) These entries is directly at  theRoot of  theZipfile. The R.txtfile  is  theOutput ofAapt with --output-text-symbols. "

See this directory, is not the dream of resource file packaging it! Very excited, is there? Ha ha......
Through this query about AAR, found this site is still good, there are many instructions about the use of Android studio,
http://tools.android.com/tech-docs/new-build-system/

2,aar Packaging

1> to a module to be packaged into AAR, first this module should be a library, if it is a applicateion, there is no need to package into AAR directly generated apk, so first make sure that this module is a library!
2> on the command line into the module's folder (below is the file under My Library Module's folder):
/WyfCode/data$ ls
build.gradle data.iml libs proguard-rules.pro src

3> Direct Execution Command:
gradle build
4. After successful execution of the above command, the module folder will have one more folder: Build, as follows:

/WyfCode/data$ lsbuild  build.gradle    data.iml  libs  proguard-rules.pro  src

The packaged AAR is under directory/build/outputs/aar/.

3. Quoting AAR

Transferred from: http://stackoverflow.com/questions/16682847/ How-to-manually-include-external-aar-package-using-new-gradle-android-build-syst

fileinfolderfile name is cards.aar )theninandwithfiles.repositories {    flatDir {        ‘libs‘    }}dependencies {    compile(name:‘cards‘, ext:‘aar‘in build -> exploded-aar`

Android Studio Packaging Reference for AAR

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.