我正在尝试导入Google Play服务愿景,但给我这个错误:



构建gradle为:

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

buildscript {
  ext.kotlin_version = '1.2.51'
  repositories {
    google()
    jcenter()
    maven {
        url "https://maven.google.com"
    }
 }
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-
     plugin:$kotlin_version"
    classpath 'com.google.gms:google-services:15.0.2'
    compile 'com.google.android.gms:play-services-vision:15.0.2'

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

allprojects {
 repositories {
    google()
    jcenter()
    maven {
        url "https://maven.google.com"
    }
  }
 }

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

谁能帮我?

最佳答案

不要将应用程序依赖项放在顶层build.gradle中,而应使用模块级别的app/build.gradle定义应用程序依赖项。

从顶级build.gradle中删除此行,并将其移至应用程序级别build.gradle

 compile 'com.google.android.gms:play-services-vision:15.0.2'

希望它将解决您的问题。

关于android - 找不到方法compile()Google GMS,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/52007785/

10-14 20:44
查看更多