I have several recurrent logs in Crashlytics that I can't read.
java.lang.NullPointerException
at ahm.onClick(SourceFile:239)
at android.view.View.performClick(View.java:4212)
at android.view.View$PerformClick.run(View.java:17476)
at android.os.Handler.handleCallback(Handler.java:800)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5431)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(NativeStart.java)
AND
java.lang.NullPointerException
at com.app.mobile.RutaActivity.a(SourceFile:747)
at ahh.run(SourceFile:1055)
at java.lang.Thread.run(Thread.java:856)
In the first log, the name of my app's package is never mentioned, so I don't even know where to look for my NPE.
In the second log, I have the FileName (RutaActivity) but when I look at the line number, I see no place for a NPE bug...
How can I do? How can I do in the second log to see the method name instead of a?
My Proguard file:
##---------------Begin: proguard configuration common for all Android apps ----------
-optimizationpasses 5
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-dump class_files.txt
-printseeds seeds.txt
-printusage unused.txt
-printmapping mapping.txt
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-allowaccessmodification
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable, LocalVariableTable,LocalVariableTypeTable
-repackageclasses ''
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-dontnote com.android.vending.licensing.ILicensingService
-keep public class * extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}
# Explicitly preserve all serialization members. The Serializable interface
# is only a marker interface, so it wouldn't save them.
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
# Preserve all native method names and the names of their classes.
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclassmembers class * extends android.content.Context {
public void *(android.view.View);
public void *(android.view.MenuItem);
}
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
# Preserve static fields of inner classes of R classes that might be accessed
# through introspection.
-keepclassmembers class **.R$* {
public static <fields>;
}
##---------------End: proguard configuration common for all Android apps ----------
##---------------Begin: proguard configuration for Gson ----------
# 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
# Gson specific classes
-keep class sun.misc.Unsafe { *; }
# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }
##---------------End: proguard configuration for Gson ----------
##---------------Begin proguard configuration for Google Maps --------------------
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**
-keep class org.** { *; }
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
##---------------End proguard configuration for Google Maps --------------------
##---------------Begin proguard configuration for my libs -----------------------
-keep class com.todddavies.components.progressbar.** { *; }
-dontwarn com.todddavies.components.progressbar.**
-dontwarn org.apache.**
-keepclassmembers class * implements android.os.Parcelable {
static ** CREATOR;
}
#Disable logging
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
public static *** i(...);
}
-keep class com.app.mobile.vo.Captura { *; }
-keep class com.app.mobile.vo.Formulario { *; }
-keep class com.app.mobile.vo.Metrica { *; }
-keep class com.app.mobile.vo.Pdv { *; }
-keep class com.app.mobile.vo.Proyecto { *; }
-keep class com.app.mobile.vo.Producto { *; }
-keep class com.app.mobile.vo.Nota { *; }
-keep class com.app.mobile.vo.Encuesta { *; }
-keep class com.app.mobile.vo.Usuario { *; }
-keep class com.app.mobile.vo.BambooPerf { *; }
-keep class com.app.mobile.vo.SoftwareVersion { *; }
I contact Crashlytics support, and I resolved the problem!
They told me to check Crashlytics.log:
On Linux / Windows: ~/.crashlytics/com.crashlytics.tools/crashlytics.log
On Mac: ~/Library/Caches/com.crashlytics/com.crashlytics.tools/crashlytics.log
Here I saw that:
Crashlytics detected deobfuscation, but did not find a mapping file at /Users/admin/AndroidstudioProjects/MyApp/build/outputs/mapping/release/mapping.txt
So I just changed
-printmapping mapping.txt
to
-printmapping build/outputs/mapping/release/mapping.txt
and it worked!
Tx for you help !
I just have the following 2 lines in my Proguard file for Crashlytics:
-keep class com.crashlytics.** { *; }
-keepattributes SourceFile,LineNumberTable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With