0

I am trying to add Dagger2 dependency in AndroidStudio 3.0. But due to this reason I am unable to add dagger2 dependency.

Could not find method apt() for arguments [com.google.dagger:dagger-compiler:2.8] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. Open File

annotationProcessor "com.google.dagger:dagger-compiler:2.8"
apt 'com.google.dagger:dagger-compiler:2.8'
compile "com.google.dagger:dagger:2.10"
provided 'javax.annotation:jsr250-api:1.0'
compile 'javax.inject:javax.inject:1'
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
jazzbpn
  • 6,441
  • 16
  • 63
  • 99

2 Answers2

3

Just Add these dependencies. Remove apt

// Dagger Dependencies (Dependency Injection)
    implementation 'com.google.dagger:dagger:2.12'
    annotationProcessor 'com.google.dagger:dagger-compiler:2.12'
    implementation 'com.google.dagger:dagger-android:2.12'
    annotationProcessor 'com.google.dagger:dagger-android-processor:2.12'
    implementation 'com.google.dagger:dagger-android-support:2.11'
    annotationProcessor 'com.google.dagger:dagger-android-support:2.11'
Dipendra Sharma
  • 2,404
  • 2
  • 18
  • 35
2

You don't need the apt dependency for android. Remove it. You also want to use the same version for the annotationProcessor and the dependency. It's 2.13 right now.

Murat Karagöz
  • 35,401
  • 16
  • 78
  • 107