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