Using flatDirs should be avoided because it doesn't support any meta-data formats

Viewed 27876

I'm seeing the following warning when building in Android Studio:

Using flatDirs should be avoided because it doesn't support any meta-data formats

enter image description here

I'm integrating with an aar that is packaged locally in my libs directory. Is there another way to integrate without adding the following problematic block to my build.gradle?

repositories {
    flatDir {
        dirs 'libs'
    }
}
3 Answers

Inside your build.gradle file,
add following piece of code in android block:

android { ..
  sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
        }
    }
}

and add dependency as:

implementation (files("libs/test_name.aar"))

delete following block:

repositories {
    flatDir {
        dirs 'libs'
    }
}

Use the LIBS directory. Remove that code and replace it by the following in the module.gradle.

android {
    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
        }
    }
}

You can add the aar like this, without the need to use flatDir :

dependencies {
    implementation files('/path/to/dir/something_local.aar')
}
Related