Using flatDir should be avoided because it doesn't support any meta-data formats.解决办法

在升级了Android Studio和Gradle后,运行的时候会出现这样的警告

AGPBI: {"kind":"warning","text":"Using flatDir should be avoided because it doesn't support any meta-data formats.","sources":[{}]}

解决办法

1.移除项目gradle文件下的flatDir,例如

之前是

allprojects {
    repositories {
        jcenter()
        google()
        maven {
            url "https://www.jitpack.io"
        }
        maven { url "https://dl.bintray.com/drummer-aidan/maven/" }
        mavenCentral()
        flatDir {
            dirs 'libs'
        }

    }
}

修改完成后

allprojects {
    repositories {
        jcenter()
        google()
        maven {
            url "https://www.jitpack.io"
        }
        maven { url "https://dl.bintray.com/drummer-aidan/maven/" }
        mavenCentral()

    }
}

2.app的gradle文件下增加

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

3.修改依赖描述

之前是

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation(name: 'alipaySdk-15.5.7-20181023110917', ext: 'aar')

修改成

    implementation fileTree(include: ['*.?ar'], dir: 'libs')
    implementation files('libs/alipaySdk-15.5.7-20181023110917.aar')

完结撒花

你可能感兴趣的:(Using flatDir should be avoided because it doesn't support any meta-data formats.解决办法)