错误:无法解决:运行时

时间:2018-06-10 22:37:36

标签: android-studio

所以我的项目昨天工作正常,我今天试图打开它,它给了我这个错误,非常感谢帮助 我试图搜索很长一段时间,但是看起来所有答案都没有与我合作

错误:无法解决:运行时 打开文件

这是build.gradle(Project)文件:

BooleanBinding

这里是构建应用配置文件

   // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.2.0'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

4 个答案:

答案 0 :(得分:15)

根据Android Studio 3.1.2 : Failed to resolve: runtime中的答案,尝试将build.gradle项目文件中的导入顺序更改为

allprojects {
    repositories {
        google()
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
        jcenter()

    }
}

这对我有用。

答案 1 :(得分:1)

allprojects {
    repositories {
        google()
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
        jcenter()

    }
}

您必须将google()作为第1行。提醒第一行。我希望它会对你有所帮助。

答案 2 :(得分:1)

这非常奇怪,我花了将近4-5个小时来修复。但是,事实证明,您需要将google()放在顶部,并将jcenter()放在所有模块的构建文件中的存储库底部。 Maven可以介入其中,它将被修复。

答案 3 :(得分:1)

这对我有用

repositories {
    google()`Goolge repo`
    jcenter()
    maven {
        url 'https://maven.google.com/ `Google maven repo`
        name 'Google'
    }

}
相关问题