Reputation: 93
I'm trying to import google play services vision but give me this error:
Could not find method compile() for arguments [com.google.android.gms:play-services-vision:15.0.2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Build gradle is:
// 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
}
Can anyone help me?
Upvotes: 1
Views: 96
Reputation: 5321
Do not place your application dependencies in top level build.gradle
, instead use module level app/build.gradle
to define your app dependencies.
Remove this line from this top level build.gradle
and move it to app level build.gradle
.
compile 'com.google.android.gms:play-services-vision:15.0.2'
Hopefully, it will resolve your issue.
Upvotes: 1