Adding AAR Files to Your Android Studio Project
AAR (Android Archive) files are a convenient way to distribute packages– mainly libraries– for use with Android Studio and Gradle. Adding one of these files to your app requires creating some metadata files and updating your app’s gradle build files. Fortunately, Android Studio can handle all of this for us.
1. Open up the project structure by right-clicking on your project and choosing “Open Module Settings” or choosing “File” > “Project Structure…”
2. Click the “+” button in the top left to add a new module.
3. Choose “Import .JAR or .AAR Package” and click the “Next” button.
4. Find your file using the ellipsis button (“…”) beside the “File name” field. Studio will automatically create a subproject name. Just click “Finish”.
5. Gradle will sync, which may take a few minutes. Add the new module as a dependency to your app. In the “Project Structure…” window, a new module has appeared representing the SDK. Keep the app’s module selected and click on the Dependencies pane.
6. Use the “+” button at the bottom of the dependencies screen, and choose “module dependency”. The dependencies screen is quite tall, so this button might be invisible at first.
7. The screen that pops up should show the Millennial Ad SDK. Just click “OK”.
8. Gradle will sync again. While you’re on this screen, if you haven’t already done so, add Google Play Services (a dependency of the SDK) by clicking the “+” button at the bottom of the dependency screen, choosing “Library Dependency”, and finding the appropriate