Crashlytics中的Proguard Stack

时间:2015-05-20 22:43:04

标签: android proguard crashlytics

我在Crashlytics中有几个经常性的日志,我无法阅读。

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)

在第一个日志中,我的应用程序包的名称从未被提及,因此我甚至不知道在哪里寻找我的NPE。

在第二个日志中,我有FileName(RutaActivity)但是当我查看行号时,我看不到NPE错误的地方......

我该怎么办? 如何在第二个日志中查看方法名称而不是?

我的Proguard文件:

##---------------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 { *; }

3 个答案:

答案 0 :(得分:14)

我联系Crashlytics支持,我解决了这个问题!

他们告诉我查看Crashlytics.log:

在Linux / Windows上: 〜/ .crashlytics / com.crashlytics.tools / crashlytics.log

在Mac上: 〜/库/缓存/ com.crashlytics / com.crashlytics.tools/crashlytics.log

我在这里看到了:

Crashlytics detected deobfuscation, but did not find a mapping file at /Users/admin/AndroidstudioProjects/MyApp/build/outputs/mapping/release/mapping.txt

所以我刚刚改变了

-printmapping mapping.txt

-printmapping build/outputs/mapping/release/mapping.txt

它有效!

Tx为你提供帮助!

答案 1 :(得分:4)

我在Proguard文件中为Crashlytics提供以下两行:

-keep class com.crashlytics.** { *; }
-keepattributes SourceFile,LineNumberTable

答案 2 :(得分:0)

要添加@Dharmendra提到的内容,在当前版本的Crashlytics中,their documentation说:

  

要让Fabric正确去除崩溃报告,您需要从配置文件中删除这一行,否则我们将无法自动上传您的映射文件:

     

-printmapping mapping.txt

此外,如果您在自己的Android库中包含父项目使用的代码,请确保在项目和库的proguard-rules.pro文件中删除它(这是我的问题)。