Error:(36, 0) Could not find method api() for arguments [project ':model'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler
Please help me.
This is my build.gradle file.
apply plugin: 'com.android.application'
//apply plugin: 'io.fabric'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
 applicationId "com.manafzar.mytaxi.driver"
 minSdkVersion 16
 targetSdkVersion 26
 versionCode 23
 versionName "2.0.3"
 multiDexEnabled true
 vectorDrawables.useSupportLibrary = true
 javaCompileOptions {
    annotationProcessorOptions {
    arguments = [eventBusIndex: 
   'com.manafzar.mytaxi.driver.DriverEventBusIndex']
  }
 }
}
buildTypes {
 release {
   minifyEnabled false
   proguardFiles getDefaultProguardFile('proguard-android.txt'), 
      'proguard-rules.pro'
  }
}
dataBinding {
  enabled = true
  }
}
dependencies {
   annotationProcessor 'org.greenrobot:eventbus-annotation-processor:3.0.1'
   api project(':model')
   api 'com.google.maps.android:android-maps-utils:0.5'
   api 'com.diogobernardino:williamchart:2.5.0'
}
apply plugin: 'com.google.gms.google-services'
                I ran into the same issue when migrating from Gradle 5.0 to Gralde 6.0.x.
As @ShadowMan mentioned, the issue was missing the java-library plugin which introduces the api method. 
In your build.gradle file you should include:
plugins {
    id 'java-library'
}
More info can be found here: https://docs.gradle.org/current/userguide/java_library_plugin.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With