Android Studio 1.1.0 does not get references of aa

2019-05-25 04:40发布

问题:

I made a module library in android studio 1.0.0. From that I took the .aar file & used it to other project. But after updating my android studio to 1.1.0 when I import it, I does not get any reference from it.

Doing some research I found that it is for gradle build version in build.gradle

dependencies {
    classpath 'com.android.tools.build:gradle:1.1.0'
}

If downgrade it to 1.0.0 then any references from .aar file(1.0.0) are found. But I think this is not best solution. So, any help would be appreciable.

Thanks

回答1:

in project window (press Alt+1) > switch to Project view (from top of this window), create a folder in app by name aar.
make a copy from myLibrary.aar and put in app/aar. then

write below code in MyProject > build.gradle

buildscript {
    repositories {
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.0'
    }
}

allprojects {
    repositories {
        jcenter()
        flatDir {
            dirs 'aar'
        }
    }
}

and write below code in MyProject/app > build.gradle

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

it's working for me! :)