I have to add .aar files as a library in a sub project in Android studio. It gives me an error.

前端 未结 2 1103
一生所求
一生所求 2021-02-15 06:42

I have added the .aar files to libs folder in the sub-project. And have given the repositories as:

repositories {
 mavenCentral()
    mavenLocal()
    flatDir {
         


        
相关标签:
2条回答
  • 2021-02-15 07:02

    You need to set the dependencies too:

    compile fileTree(dir: 'libs', include: ['*.jar','*.aar'])
    

    This can be done in the subprojects build.gradle.


    Edit: You might need to specify the file itself:

    compile(name:'name-of-file',ext:'aar')
    
    0 讨论(0)
  • 2021-02-15 07:16

    In the repositories of your module: app

    repositories {
    
        flatDir {
            dirs 'libs'
        }
    }
    

    Add the following in the dependencies of your module: app In the case that your have both a JAR and an AAR file, do the following.

    dependencies 
    {
      implementation (name: '***library name***', ext: 'aar')
      implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'], )
    
    }
    
    0 讨论(0)
提交回复
热议问题