Marcus Gabilheri
Marcus Gabilheri

Reputation: 1289

Android Studio cannot find AAR packages

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

So... I've made a library and exported is an aar file. Inside android studio I selected Import Module and them Import .JAR or .AAR Package.

The project compiles and works with the classes inside the aar file but Android studio can not find the classes or offer any auto completion of so all.

Here is a few of screenshots:

screenshot1 enter image description here enter image description here

The same problem also happens with other @aar libraries imported the same way: 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'

Upvotes: 6

Views: 15750

Answers (2)

anddev84
anddev84

Reputation: 1483

This may not be the quickest way, but this works for autocompletion and also solved my problem of missing classes when I tried compiling my local AAR using the method @puj 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 do a Gradle sync.

Android Library AAR depending on another library

Upvotes: 0

puj
puj

Reputation: 770

Looks like you could do this How to manually include external aar package using new Gradle Android Build System

If you have them in your lib folder

repositories {
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    compile(name:'UpPlatformSdk', ext:'aar')
}

Upvotes: 4

Related Questions