为什么DependencyResolveDetails用红色突出显示

时间:2019-02-13 08:46:05

标签: android

我的应用gradle文件中的DependencyResolveDetails突出显示为红色。 我的Android Studio是3.3,如何解决此警告。

    configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '28.0.0'
            }
        }

    }
}

警告消息是:

Cannot resolve symbol 'DependencyResolveDetails' 

3 个答案:

答案 0 :(得分:4)

只需删除“ DependencyResolveDetails”:

configurations.all { //fix ClassNotFoundException : OnUnhandledKeyEventListener
    resolutionStrategy.eachDependency { details ->
        def requested = details.requested
        if (requested.group == "com.android.support") {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion "26.+"
            }
        }
    }
}

答案 1 :(得分:-1)

在您的Project build.gradle文件中,将依赖项至少设置为gradle 3.3.0:

dependencies {
    classpath 'com.android.tools.build:gradle:3.3.0'
}

答案 2 :(得分:-1)

我也遇到了这个错误,但现在解决了

仅下载ndk表单文件->项目结构->并下载ndk

享受代码。