This issue might be related to some SO questions as i searched a lot here, but no any post helped me. My app running when it is unsigned but it crashes instantly when i run the signed APK. I put it debuggable true
in gradle and checked i found this error logcat.
java.lang.NoSuchFieldError: No static field REPLACE of type Lcom/a/a/a$a; in class Lcom/a/a/a$a; or its superclasses (declaration of 'com.a.a.a$a' appears in /data/app/com.aami.aruman.com-J1sPXkw9O_ZNL4zfcpqgMQ==/base.apk)
at java.lang.reflect.Field.getAnnotationNative(Native Method)
at java.lang.reflect.Field.getAnnotation(Field.java:847)
at com.a.g.<init>(Unknown Source:94)
at com.a.f.a(Unknown Source:97)
at com.a.f.a(Unknown Source:126)
at com.a.f.<init>(Unknown Source:27)
at com.a.b.a(Unknown Source:22)
at com.a.a.a(Unknown Source:3)
at com.a.a.a(Unknown Source:1)
at com.a.a.a(Unknown Source:9)
at com.a.b.a.onCreate(Unknown Source:3)
at com.aami.aruman.com.codingnation.base.DroiderApplication.onCreate(Unknown Source:0)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1120)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5747)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6501)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
07-12 22:22:18.355 13073-13073/com.aami.aruman.com E/UncaughtException: java.lang.NoSuchFieldError: No static field REPLACE of type Lcom/a/a/a$a; in class Lcom/a/a/a$a; or its superclasses (declaration of 'com.a.a.a$a' appears in /data/app/com.aami.aruman.com-J1sPXkw9O_ZNL4zfcpqgMQ==/base.apk)
at java.lang.reflect.Field.getAnnotationNative(Native Method)
at java.lang.reflect.Field.getAnnotation(Field.java:847)
at com.a.g.<init>(Unknown Source:94)
at com.a.f.a(Unknown Source:97)
at com.a.f.a(Unknown Source:126)
at com.a.f.<init>(Unknown Source:27)
at com.a.b.a(Unknown Source:22)
at com.a.a.a(Unknown Source:3)
at com.a.a.a(Unknown Source:1)
at com.a.a.a(Unknown Source:9)
at com.a.b.a.onCreate(Unknown Source:3)
at com.aami.aruman.com.codingnation.base.DroiderApplication.onCreate(Unknown Source:0)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1120)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5747)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6501)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
I have seen in posts, that posting build.gradle
can make it easy to understand the error so here is.
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 26
useLibrary 'org.apache.http.legacy'
buildToolsVersion '27.0.3'
defaultConfig {
multiDexEnabled true
applicationId "com.aami.aruman.com"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
android {
lintOptions {
checkReleaseBuilds false
abortOnError false
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/maven/pom.properties'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/gson/FieldAttributes.class'
exclude '.readme'
}
}
buildTypes {
release {
debuggable true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.firebase:firebase-messaging:12.0.1'
implementation 'com.android.support:appcompat-v7:26.1.+'
implementation 'com.android.support:gridlayout-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.facebook.android:facebook-android-sdk:4.10.0'
implementation 'com.android.support:design:26.1.+'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'de.hdodenhof:circleimageview:1.3.0'
implementation 'com.google.android.gms:play-services-places:12.0.1'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.google.android.gms:play-services-maps:12.0.1'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.lzyzsd:circleprogress:1.2.1'
implementation 'com.romandanylyk:pageindicatorview:0.2.0'
implementation 'com.nshmura:snappysmoothscroller:1.0.0'
implementation 'com.codemybrainsout.rating:ratingdialog:1.0.8'
implementation 'org.adw.library:discrete-seekbar:1.0.1'
implementation 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.google.firebase:firebase-auth:12.0.1'
implementation 'com.google.firebase:firebase-storage:12.0.1'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.facebook.fresco:fresco:1.3.0'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.nispok:snackbar:2.11.+'
implementation 'com.github.ybq:Android-SpinKit:1.1.0'
implementation 'com.gmail.samehadar:iosdialog:1.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'joda-time:joda-time:2.9.4'
implementation 'com.crystal:crystalrangeseekbar:1.1.3'
implementation 'com.google.firebase:firebase-crash:12.0.1'
implementation 'com.github.clans:fab:1.6.2'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.2@aar') {
transitive = true
}
implementation 'com.github.florent37:singledateandtimepicker:2.0.5'
implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation 'com.payumoney.sdkui:plug-n-play:1.3.0'
implementation 'com.amitshekhar.android:jackson-android-networking:1.0.1'
implementation 'com.daasuu:animateHorizontalProgressBar:0.2.4'
}
apply plugin: 'com.google.gms.google-services'
And finally this is the proguard
.
-dontwarn org.apache.**
-dontwarn javax.annotation.**
-dontwarn com.squareup.picasso.**
-dontwarn okio.**
-keep class com.google.**
-dontwarn com.google.**
-keepattributes Signature
-dontwarn retrofit2.Platform$Java8
# For using GSON @Expose annotation
-keepattributes *Annotation*
-dontwarn org.**
-dontwarn javax.**
# Gson specific classes
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.** { *; }
-keep class com.squareup.okhttp.{ *; }
-dontwarn com.squareup.okhttp.**
-keep class com.facebook.{ *; }
-dontwarn com.facebook.**
-keep class ohttp3.{ *; }
-dontwarn okhttp3.**
-keep class org.joda.{ *; }
-dontwarn org.joda.**
-keepclassmembers class * {
private <fields>;
}
# Proguard configuration for Jackson 2.x (fasterxml package instead of codehaus package)
-keep class com.fasterxml.jackson.databind.ObjectMapper {
public <methods>;
protected <methods>;
}
-keep class com.fasterxml.jackson.databind.ObjectWriter {
public ** writeValueAsString(**);
}
-keepnames class com.fasterxml.jackson.** { *; }
-keepclassmembers class com.aami.aruman.com.codingnation.beans.** { *; }
-dontwarn com.fasterxml.jackson.databind.**
-dontwarn org.springframework.**