I am not very experienced in Android Studio and I have tried countless ways to solve this issue with no success.
Goal: Import an .aar
file as a library into an Android Studio app.
Problem:
- I have a .aar file (product_test-debug.aar)
- I imported it into an Android Studio empty app, using:
- File → New Module → Import JAR/AAR Package
- I already had one issue in this phase, perhaps due to the question mark in the .aar file; after selecting the file, Android Studio studio would tell me it didnt exist. This error mysteriously disapeared so I'll carry on.
- The .aar file was added. However, when I switch from Android to Project mode, I can see the file still shows a question mark.
Ignoring the question mark, I did 3 things next, following a successful guide:
- In the settings-gradle, I modified the only line to:
- In the build.gradle (Module:app), I added the first dependency:
- Still in this script, I commented the following line:
- In the settings-gradle, I modified the only line to:
After all these steps, I have tried to sync the gradle and it still does not recognize the .aar. These are the errors:
I tried to put the .aar file into the libs folder, and alter this function in build.gradle(Project:MyApplication) to this:
But it doesn't solve anything. I know what I am trying to do is possible because of the guide, but I don't know what I am missing. The guide is this one for reference:
(Btw for context, I am doing this to be able to launch a sample Unity app from an Android activity. In this case, the Unity app is a spinning cube.)
Thank you very much for your time and assistance in this matter.