Android Studio Project Import AAR package error

Source: Internet
Author: User

Recently trying to access Trpay's SDK, according to its home documentation needs to import their AAR package (paysdk-release-1.2.2. Aar).

In the as in how to import AAR package for Android project, online search can see nothing but the following three steps:

1. Place the AAR in the Libs directory of the module. When creating a new Android project, the default module name is the app, which is placed under app/libs/.

2. Add the following configuration to the app's Build.gradle.

Repositories {        Flatdir {                ' libs '   //  AAR directory       }}

3. Add the AAR reference in the app's Build.gradle dependencies.

Compile (name: ' Zbar-release ', ext: ' AAR ')
Pit Point: The two-segment code added above Build.gradle is added to the Build.gradle in the app module, not the Build.gradle in the project root!!!

Online search of the article did not mention this point, trpay access to the document also did not say clearly this point (such as), the wrong location will be error. For those unfamiliar with the development of Android, May somehow fall into the pit.

Because the root of the build.gradle in the default already has the repositories node, and the app's Build.gradle not, I mistakenly think that these two pieces of code need to write separately to two build.gradle ...

Now create an Android project with AS, add a module named MyLibrary, and delete the default app module. The project directory is as follows.

Reference:

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

Android Studio Project Import AAR package error

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.