Android Studio or Gradle does not compile dagger generated classes
I have one Android library that I created using the Dependency Injection Dagger ("br.com.estudio89: syncing: 1.0-SNAPSHOT"). The dependency manager that I used when building this library was Maven.
Now I am working on another project where I need to use this library, but this time I am using Gradle to manage dependencies.
What is happening now is that the classes generated by the dagger in my library are not compiling into my new application, causing a NoClassDefFoundError:
java.lang.NoClassDefFoundError: br.com.estudio89.syncing.injection.AppContextModule$$ModuleAdapter$ProvideAppContextProvidesAdapter
I also get the following errors:
05-03 01:26:48.147 30634-30634/br.com.estudio89.rhmais E/dalvikvm﹕ Could not find class 'dagger.internal.Binding', referenced from method dagger.internal.FailoverLoader.getAtInjectBinding
05-03 01:26:48.155 30634-30634/br.com.estudio89.rhmais E/dalvikvm﹕ Could not find class 'dagger.internal.SetBinding', referenced from method dagger.ObjectGraph$StandardBindings.<init>
05-03 01:26:48.171 30634-30634/br.com.estudio89.rhmais E/dalvikvm﹕ Could not find class 'dagger.internal.Binding', referenced from method dagger.internal.BindingsGroup.get
05-03 01:26:48.171 30634-30634/br.com.estudio89.rhmais E/dalvikvm﹕ Could not find class 'dagger.internal.Binding', referenced from method dagger.internal.BindingsGroup.put
05-03 01:26:48.171 30634-30634/br.com.estudio89.rhmais E/dalvikvm﹕ Could not find class 'br.com.estudio89.syncing.injection.AppContextModule$$ModuleAdapter$ProvideAppContextProvidesAdapter', referenced from method br.com.estudio89.syncing.injection.AppContextModule$$ModuleAdapter.getBindings
05-03 01:26:48.175 30634-30634/br.com.estudio89.rhmais E/dalvikvm﹕ Could not find class 'br.com.estudio89.syncing.injection.DataSyncHelperModule$$ModuleAdapter$ProvideCustomTransactionManagerProvidesAdapter', referenced from method br.com.estudio89.syncing.injection.DataSyncHelperModule$$ModuleAdapter.getBindings
You can see the build.gradle file below:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
apply plugin: 'android'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 21
buildToolsVersion "21.0.0"
defaultConfig {
minSdkVersion 9
targetSdkVersion 21
multiDexEnabled = true
}
lintOptions {
abortOnError false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
apt 'com.squareup.dagger:dagger-compiler:1.2.2'
compile 'com.squareup.dagger:dagger:1.2.2'
apt 'br.com.estudio89:syncing:1.0-SNAPSHOT'
compile (
'com.github.satyan:sugar:1.3',
'se.emilsjolander:stickylistheaders:2.5.2',
'com.joanzapata.android:android-iconify:1.0.9',
'uk.co.chrisjenx:calligraphy:2.0.1',
'com.github.bluejamesbond:textjustify-android:2.1.0',
'br.com.estudio89:syncing:1.0-SNAPSHOT',
'br.com.estudio89:push_messaging:1.0-SNAPSHOT',
'com.android.support:support-v4:21.0.0',
'com.android.support:appcompat-v7:21.0.0',
'com.google.android.gms:play-services:7.3.0',
)
}
task wrapper(type: Wrapper) {
gradleVersion = '2.2.1'
}
I don't know if this is a Gradle or Android Studio problem, but I tried everything I could and couldn't find a solution ... For the current project, I am not actually using the dagger, but I added it to the Gradle file in the hopes. that it will work ... Any help would be greatly appreciated!
source to share
No one has answered this question yet
Check out similar questions: