Could not find method implementation() for arguments [com.google.firebase:firebase-ml-model-interpreter:15.0.0]

Vivek Jm picture Vivek Jm · Aug 10, 2018 · Viewed 10.2k times · Source

I am trying to open existing android project in Android Studio and gradle cannot build the app and it shows the error as:

Error : strong text Could not find method implementation() for arguments [com.google.firebase:firebase-ml-model-interpreter:15.0.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.google.firebase.codelab.mlkit_custommodel"
    minSdkVersion 19
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
aaptOptions {
    noCompress "tflite"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.google.firebase:firebase-ml-model-interpreter:15.0.0'
 }
   apply plugin: 'com.google.gms.google-services'

Answer

sanjeev picture sanjeev · Aug 10, 2018

As AS suggests could not find method implementation() for arguments which means the gradle does not recognize your implementation in gradle. It implies that you are using an old version of gradle, when compile method was used.

NOTE:

So, the solution is to update your gradle to the latest version and try again. Method implementation is supported in versions 3.4 or later.