Android Studio cannot resolve symbols from imported AAR module

前端 未结 2 1459
感动是毒
感动是毒 2020-12-07 01:15

All of the answers in similar questions talk about manunally editting gradle files. But I\'ve used Android Studio to import the AAR file and checked the build.gradle files a

相关标签:
2条回答
  • 2020-12-07 01:44

    You need to specify the location of "ShowCaseView-5.0.0.aar" in project's build.gradle file. E.G, the ShowCaseView-5.0.0.aar file is in a folder named "libs" under project's root directory, update you build.gradle file to add following

    allprojects {
        repositories {
            flatDir {
                dirs 'libs'
            }
        }
    }
    
    0 讨论(0)
  • 2020-12-07 01:46

    Recently, I encountered this very same issue. I had an AAR to import into my project. The library was distributed only as AAR. I resolved it by putting my AAR file inside libs/ folder and added the following line in my app module's gradle:

    dependencies {
        ...
        compile files('libs/theFirstLib.aar')
    }
    

    You can also add multiple AARs like so:

    dependencies {
        ...
        compile files('libs/theFirstLib.aar', 'libs/theSecondLib.aar')
    }
    

    If you are using Gradle 3.0.0 or higher, you may need to substitue compile with implementation:

    implementation files('libs/theFirstLib.aar')
    

    Worked like a charm!

    NOTE: Importing an AAR sometimes results to another "cannot resolve symbol" error, which I resolved here when Android Studio and Gradle don't agree.

    0 讨论(0)
提交回复
热议问题