美文网首页
Using flatDir should be avoided

Using flatDir should be avoided

作者: 克罗克达尔 | 来源:发表于2021-10-08 15:28 被阅读0次

    在升级了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

          本文链接:https://www.haomeiwen.com/subject/hosxoltx.html