Android Studio cannot find AAR packages

I am having a problem with Android Studio recognizing classes inside @aar library imported locally.

So ... I created a library and exported the aar file. Inside the Android studio, I selected Import Module and their Import .JAR or .AAR Package .

The project compiles and works with classes inside the aar file, but Android studio cannot find classes or offer automatic completion like that for everyone.

Here are some screenshots:

screenshot1enter image description hereenter image description here

A similar problem occurs with other imported @aar libraries: enter image description here

Any suggestions?

Edit:

build.gradle:

 ... dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile project(':UpPlatformSdk') compile project(':simpleorm') ... // more libraries here } 

settings.gradle:

 include ':app', ':UpPlatformSdk', ':wear', ':simpleorm' 
+5
source share
2 answers

It looks like you could do this How to manually enable an external aar package using the new Android Gradle build system

If you have them in the lib folder

 repositories { flatDir { dirs 'libs' } } dependencies { compile(name:'UpPlatformSdk', ext:'aar') } 
0
source

This may not be the fastest way, but it works for autocompletion, and also solves my problem with missing classes when I tried to compile my local AAR using the @puj method described. Essentially, you need to create a local Maven repository to host the AAR, but any changes you make are pulled by the build system when you perform Gradle synchronization.

Android AAR library depending on another library

0
source

Source: https://habr.com/ru/post/1215481/


All Articles