google / dagger

A fast dependency injector for Android and Java.
https://dagger.dev
Apache License 2.0
17.45k stars 2.02k forks source link

java.lang.NoClassDefFoundError: dagger/internal/DoubleCheckLazy #428

Closed alphater closed 8 years ago

alphater commented 8 years ago

Error:Execution failed for task ':mobile:compileDebugJavaWithJavac'.

> java.lang.NoClassDefFoundError: dagger/internal/DoubleCheckLazy

Project build.gradle

`buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.2' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' classpath 'me.tatarka:gradle-retrolambda:3.3.0-beta4' classpath 'com.jakewharton:butterknife-gradle-plugin:8.2.1' } }

allprojects { repositories { jcenter() mavenCentral() maven { url 'https://jitpack.io' } maven { url 'http://maven.localytics.com/public' } maven { url "https://repo.adobe.com/nexus/content/repositories/releases/" } maven { url 'http://mvn.leancloud.cn/nexus/content/repositories/releases' } } } `

mobile build.gradle

` apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt' apply plugin: 'me.tatarka.retrolambda'

dependencies { compile fileTree(include: ['*.jar'], dir: 'libs')

final DAGGER_VERSION = '2.2'
apt "com.google.dagger:dagger-compiler:$DAGGER_VERSION"

compile project(':CoreCommon')

compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'

} `

Library build.gradle

` apply plugin: 'com.android.library' apply plugin: 'me.tatarka.retrolambda' apply plugin: 'com.neenbedankt.android-apt' apply plugin: 'com.jakewharton.butterknife'

dependencies { final DAGGER_VERSION = '2.6' def daggerCompiler = "com.google.dagger:dagger-compiler:$DAGGER_VERSION"

compile "com.google.dagger:dagger:$DAGGER_VERSION"
provided 'org.glassfish:javax.annotation:10.0-b28' //Required by Dagger2

} ` Thank you

ronshapiro commented 8 years ago

you probably need compile "com.google.dagger:dagger:$DAGGER_VERSION" in your mobile build.gradle. Note that you're using 2 different versions though, so you'll want to set a global variable to make sure there are no conflicts.