I'm using Dagger for DI in my app, and a few users are experiencing an issue where they download the app from the PlayStore and my app immediately crashes.
The stacktrace is as follows:
java.lang.NoClassDefFoundError: org.unos.ett.app.application.DaggerAppComponent$1
at org.unos.ett.app.application.DaggerAppComponent.initialize(DaggerAppComponent.java:316)
at org.unos.ett.app.application.DaggerAppComponent.(DaggerAppComponent.java:306)
at org.unos.ett.app.application.DaggerAppComponent.(DaggerAppComponent.java:227)
at org.unos.ett.app.application.DaggerAppComponent$Builder.build(DaggerAppComponent.java:534)
at org.unos.ett.app.application.App.createAppComponent(App.kt:47)
at org.unos.ett.app.application.App.onCreate(App.kt:36)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4749)
at android.app.ActivityThread.access$1600(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5653)
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:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
at dalvik.system.NativeStart.main(Native Method)
My dependencies:
buildToolsVersion = "25.0.2"
jdkVersion = '1.8'
minSdkVersion = 19
targetSdkVersion = 25
compileSdkVersion = 25
applicationId = "org.unos.ett.app"
kotlinStdLib = "org.jetbrains.kotlin:kotlin-stdlib-jre7:${kotlin_version}"
kotlinReflect = "org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}"
androidSupportVersion = '25.4.0'
daggerVersion = '2.9'
hockeyApp = "net.hockeyapp.android:HockeySDK:4.1.3"
appCompat = "com.android.support:appcompat-v7:${androidSupportVersion}"
design = "com.android.support:design:${androidSupportVersion}"
cardView = "com.android.support:cardview-v7:${androidSupportVersion}"
dagger = "com.google.dagger:dagger:${daggerVersion}"
daggerCompiler = "com.google.dagger:dagger-compiler:${daggerVersion}"
rxAndroid = "io.reactivex.rxjava2:rxandroid:2.0.1"
javax = "javax.annotation:jsr250-api:1.0"
dataBindingCompiler = "com.android.databinding:compiler:$gradle_plugin_version"
threeTenAbp = "com.jakewharton.threetenabp:threetenabp:1.0.5"
everNoteJob = "com.evernote:android-job:1.1.11"
gpsServices = "com.google.android.gms:play-services-gcm:11.0.1"
leakCanary = "com.squareup.leakcanary:leakcanary-android:1.5.1"
retrofitVersion = '2.2.0'
okhttpVersion = '3.7.0'
retrofit = "com.squareup.retrofit2:retrofit:${retrofitVersion}"
retrofitRxJava = "com.squareup.retrofit2:adapter-rxjava2:${retrofitVersion}"
retrofitGson = "com.squareup.retrofit2:converter-gson:${retrofitVersion}"
okHttp = "com.squareup.okhttp3:okhttp:${okhttpVersion}"
okHttpLogger = "com.squareup.okhttp3:logging-interceptor:${okhttpVersion}"
rxJava2 = "io.reactivex.rxjava2:rxjava:2.1.0"
powerMockVersion = '2.0.0-beta.5'
junit = "junit:junit:4.12"
mockitoKotlin = "com.nhaarman:mockito-kotlin:1.5.0"
assertj = "org.assertj:assertj-core:3.6.2"
roboElectric = "org.robolectric:robolectric:3.3.2"
espresso = "com.android.support.test.espresso:espresso-core:3.0.1"
espressoIntents = "com.android.support.test.espresso:espresso-intents:3.0.1"
espressoIdler = "com.android.support.test.espresso.idling:idling-concurrent:3.0.0"
espressoTestRunner = "com.android.support.test:runner:1.0.1"
dexMaker = "com.linkedin.dexmaker:dexmaker-mockito:2.2.0"
uiAutomator = "com.android.support.test.uiautomator:uiautomator-v18:2.1.3"
findBugs = "com.google.code.findbugs:jsr305:3.0.2"
And in my app/build.gradle....
compile rootProject.ext.kotlinStdLib
kapt rootProject.ext.dataBindingCompiler
compile rootProject.ext.cardView
compile rootProject.ext.design
compile rootProject.ext.appCompat
compile rootProject.ext.hockeyApp
compile rootProject.ext.rxAndroid
compile rootProject.ext.everNoteJob
compile rootProject.ext.gpsServices
compile rootProject.ext.dagger
kapt rootProject.ext.daggerCompiler
provided rootProject.ext.javax
compile rootProject.ext.retrofit
compile rootProject.ext.retrofitRxJava
compile rootProject.ext.retrofitGson
compile rootProject.ext.okHttp
debugCompile rootProject.ext.okHttpLogger
debugCompile rootProject.ext.leakCanary
compile rootProject.ext.rxJava2
testCompile rootProject.ext.junit
testCompile rootProject.ext.assertj
testCompile rootProject.ext.mockitoKotlin
testCompile rootProject.ext.roboElectric
testCompile rootProject.ext.kotlinStdLib
androidTestCompile rootProject.ext.mockitoKotlin
androidTestCompile rootProject.ext.kotlinReflect
androidTestCompile rootProject.ext.kotlinStdLib
androidTestCompile rootProject.ext.espresso
androidTestCompile rootProject.ext.espressoIntents
androidTestCompile rootProject.ext.espressoTestRunner
androidTestCompile rootProject.ext.findBugs
androidTestCompile rootProject.ext.dexMaker
androidTestCompile rootProject.ext.uiAutomator
I'm using gradle 2.3.3, and gradle version 4.0.
My proguard rules:
Remove logs
-assumenosideeffects class android.util.Log {
public static boolean isLoggable(java.lang.String, int);
public static int v(...);
public static int i(...);
public static int w(...);
public static int d(...);
public static int e(...);
}
-keep class android.support.v7.widget.RoundRectDrawable { *; }
OkHttp
-keepattributes Signature
-keepattributes Annotation
-keep class okhttp3.** { ; }
-keep interface okhttp3.* { ; }
-dontwarn okhttp3.*
Realm
-keep class org.unos.ett.app.data.entity** { ; }
-keep class io.realm.annotations.RealmModule
-keep @io.realm.annotations.RealmModule class *
-keep class io.realm.internal.Keep
-keep @io.realm.internal.Keep class *
-dontwarn javax.*
-dontwarn io.realm.**
GSON 2.2.4 specific rules
Gson uses generic type information stored in a class file when working with fields. Proguard
removes such information by default, so configure it to keep all of it.
-keepattributes Signature
For using GSON @expose annotation
-keepattributes Annotation
-keepattributes EnclosingMethod
Gson specific classes
-keep class sun.misc.Unsafe { ; }
-keep class com.google.gson.stream.* { *; }
Retrofit 2.X
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions
-keepclasseswithmembers class * {
@retrofit2.http.* ;
}
AppCompatv7
-keep public class android.support.v7.widget.** { ; }
-keep public class android.support.v7.internal.widget.* { ; }
-keep public class android.support.v7.internal.view.menu.* { *; }
-keep public class * extends android.support.v4.view.ActionProvider {
public (android.content.Context);
}
-keep class android.support.v7.widget.RoundRectDrawable { *; }
Okio
-keep class sun.misc.Unsafe { ; }
-dontwarn java.nio.file.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**
Note that this only happens for a certain set of my users, on Samsung's TabS using KitKat.
Is any further information needed?
I'm using Dagger for DI in my app, and a few users are experiencing an issue where they download the app from the PlayStore and my app immediately crashes.
The stacktrace is as follows:
java.lang.NoClassDefFoundError: org.unos.ett.app.application.DaggerAppComponent$1
at org.unos.ett.app.application.DaggerAppComponent.initialize(DaggerAppComponent.java:316)
at org.unos.ett.app.application.DaggerAppComponent.(DaggerAppComponent.java:306)
at org.unos.ett.app.application.DaggerAppComponent.(DaggerAppComponent.java:227)
at org.unos.ett.app.application.DaggerAppComponent$Builder.build(DaggerAppComponent.java:534)
at org.unos.ett.app.application.App.createAppComponent(App.kt:47)
at org.unos.ett.app.application.App.onCreate(App.kt:36)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4749)
at android.app.ActivityThread.access$1600(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5653)
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:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
at dalvik.system.NativeStart.main(Native Method)
My dependencies:
buildToolsVersion = "25.0.2"
jdkVersion = '1.8'
minSdkVersion = 19
targetSdkVersion = 25
compileSdkVersion = 25
applicationId = "org.unos.ett.app"
And in my app/build.gradle....
compile rootProject.ext.kotlinStdLib
I'm using gradle 2.3.3, and gradle version 4.0.
My proguard rules:
Remove logs
-assumenosideeffects class android.util.Log {
public static boolean isLoggable(java.lang.String, int);
public static int v(...);
public static int i(...);
public static int w(...);
public static int d(...);
public static int e(...);
}
http://stackoverflow.com/questions/29679177/cardview-shadow-not-appearing-in-lollipop-after-obfuscate-with-proguard/29698051
-keep class android.support.v7.widget.RoundRectDrawable { *; }
OkHttp
-keepattributes Signature
-keepattributes Annotation
-keep class okhttp3.** { ; }
-keep interface okhttp3.* { ; }
-dontwarn okhttp3.*
Realm
-keep class org.unos.ett.app.data.entity** { ; }
-keep class io.realm.annotations.RealmModule
-keep @io.realm.annotations.RealmModule class *
-keep class io.realm.internal.Keep
-keep @io.realm.internal.Keep class *
-dontwarn javax.*
-dontwarn io.realm.**
GSON 2.2.4 specific rules
Gson uses generic type information stored in a class file when working with fields. Proguard
removes such information by default, so configure it to keep all of it.
-keepattributes Signature
For using GSON @expose annotation
-keepattributes Annotation
-keepattributes EnclosingMethod
Gson specific classes
-keep class sun.misc.Unsafe { ; }
-keep class com.google.gson.stream.* { *; }
Retrofit 2.X
https://square.github.io/retrofit/
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions
-keepclasseswithmembers class * {
@retrofit2.http.* ;
}
AppCompatv7
-keep public class android.support.v7.widget.** { ; }
-keep public class android.support.v7.internal.widget.* { ; }
-keep public class android.support.v7.internal.view.menu.* { *; }
-keep public class * extends android.support.v4.view.ActionProvider {
public (android.content.Context);
}
http://stackoverflow.com/questions/29679177/cardview-shadow-not-appearing-in-lollipop-after-obfuscate-with-proguard/29698051
-keep class android.support.v7.widget.RoundRectDrawable { *; }
Okio
-keep class sun.misc.Unsafe { ; }
-dontwarn java.nio.file.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**
Note that this only happens for a certain set of my users, on Samsung's TabS using KitKat.
Is any further information needed?