Closed haseebrabbani closed 9 years ago
Here is my build.gradle:
buildscript { repositories { maven { url 'http://download.crashlytics.com/maven' } }
dependencies {
classpath "com.crashlytics.tools.gradle:crashlytics-gradle:$project.crashlyticsGradleVersion"
}
}
apply plugin: 'com.android.application' apply plugin: 'crashlytics' apply from: "$rootDir/gradle/signing.gradle" apply plugin: 'com.neenbedankt.android-apt'
android { compileSdkVersion 22 buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "0.1"
multiDexEnabled true
}
buildTypes {
debug {
applicationIdSuffix '.debug'
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.releaseSigning
}
}
productFlavors {
amazon {
// Empty for now.
}
play {
// Empty for now.
}
}
lintOptions {
abortOnError true
ignoreWarnings true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
dexOptions {
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
repositories { mavenLocal() mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies { compile project(':common') //compile a few other library projects...
compile fileTree(dir: 'libs', include: ['*.jar'])
apt "com.google.dagger:dagger-compiler:$project.daggerVersion"
compile "com.android.support:multidex:1.0.0"
compile "com.android.support:appcompat-v7:$project.appcompatVersion"
compile "com.android.support:recyclerview-v7:$project.recyclerviewVersion"
compile "com.crashlytics.android:crashlytics:$project.crashlyticsVersion"
compile "com.google.dagger:dagger:$project.daggerVersion"
compile "com.jakewharton:butterknife:$project.butterknifeVersion"
compile "org.glassfish:javax.annotation:$project.javaAnnotationVersion"
debugCompile "com.squareup.leakcanary:leakcanary-android:$project.leakCanaryVersion"
releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$project.leakCanaryVersion"
testCompile "junit:junit:$project.junitVersion"
testCompile "org.mockito:mockito-core:$project.mockitoVersion"
testCompile("org.robolectric:robolectric:$project.robolectricVersion") {
exclude group: 'commons-logging', module: 'commons-logging'
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
testCompile "org.powermock:powermock-api-mockito:$project.powerMockVersion"
testCompile "org.powermock:powermock-module-junit4-rule-agent:$project.powerMockVersion"
testCompile "org.powermock:powermock-classloading-xstream:$project.powerMockVersion"
testCompile "org.powermock:powermock-module-junit4-rule:$project.powerMockVersion"
testCompile "org.powermock:powermock-module-junit4:$project.powerMockVersion"
}
@haseebrabbani it's MultiDex problem.
@artem-zinnatullin thanks for the tip! Are there any solutions you could recommend?
It was in fact a multi-dex issue. My application class did not extend MultiDexApplication (even though I had enabled multidex in my build.gradle).
@haseebrabbani glad that you've fixed it! Sorry that I didn't provide the solution, I was sleeping, interrupted by notification, wrote short answer and continued seeing dreams about software development :)
Hi there! I just started using Dagger2 in my Android app. The app works just fine on Android 5.x devices, but crashes on startup on Android 4.x devices. I am testing this on my debug build where Proguard is NOT enabled. Any thoughts would be appreciated. Here is the stacktrace:
FATAL EXCEPTION: main java.lang.NoClassDefFoundError: com.myorg.myapp.application.di.AppModule_GetApplicationContextFactory at com.myorg.myapp.application.di.DaggerAppComponent.initialize(DaggerAppComponent.java:111) at com.myorg.myapp.application.di.DaggerAppComponent.(DaggerAppComponent.java:103)
at com.myorg.myapp.application.di.DaggerAppComponent.(DaggerAppComponent.java:62)
at com.myorg.myapp.application.di.DaggerAppComponent$Builder.build(DaggerAppComponent.java:235)
at com.myorg.myapp.application.MyApplication.buildDaggerComponent(MyApplication.java:97)
at com.myorg.myapp.application.MyApplication.onCreate(MyApplication.java:62)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4328)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)