Reputation: 18735
Since I published a new version of my app in the Google Play Store I receive crash reports in the Android Developer Console.
I have uploaded the ProGuard mappings.txt
right after publishing the new version. Thus all log are NOT obfuscated (all class names and methods apear in clear text). However I am still not sure hot to read them.
There are three major problems:
OR
. What does this mean?Example:
// Crash Log with is NOT obfuscated
Caused by: java.lang.NullPointerException:
1: at com.example.MyApp.Path.To.Package.MyClass.myMethod1 (MyClass.java) // <-- No Line Numbers...
or .myMethod2 (MyClass.java) // <-- WHAT does this OR mean???
or .myMethod3 (MyClass.java)
2: at com.example.MyApp.Path.To.Package.MyClass.onCreateView (MyClass.java)
3: at android.support.v4.app.Fragment.performCreateView (Fragment.java)
4: at android.support.v4.app.FragmentManagerImpl.access$500 (FragmentManagerImpl.java)
or .access$600 (FragmentManagerImpl.java)
or .addFragment (FragmentManagerImpl.java)
or .allocBackStackIndex (FragmentManagerImpl.java)
or .animateRemoveFragment (FragmentManagerImpl.java)
...
5: at android.support.v4.app.FragmentManagerImpl.access$500 (FragmentManagerImpl.java)
...
// Other crash seems to show the same problem but is still obfuscated
Caused by: java.lang.NullPointerException:
1: at com.example.MyApp.Path.To.Package.MyClass.a (MyClass.java:89) // <-- Line numbers available here...
2: at com.example.MyApp.Path.To.Package.MyClass.b (MyClass.java:40)
3: at android.support.v4.app.Fragment.performCreateView (Fragment.java)
... // Same call stack as above
Questions:
OR
statements within the call stack? Does this mean, that the exception happened in each of these methods (how should this be possible)?So the main question is:
How to use the information from the logs to find the source of the crash?
Upvotes: 4
Views: 979
Reputation: 2931
You need to add the following options to your Proguard configuration:
# This option forces Proguard to use different obfuscated names
# for different members. It avoids the 'or' stack traces.
-useuniqueclassmembernames
# These options produce useful stacktraces preserving line numbers
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
Without -useuniqueclassmembernames
, Proguard can assign identical obfuscated names for different methods from the same class (you can see it on the mapping.txt file). That's why the stacktrace knows the error happened in Method A or in Method B, but doesn't know exactly which one.
Using the -useuniqueclassmembernames
option, all obfuscated names will be different and there will be no more or stacktraces. More information about this here.
Apart from this, Proguard doesn't keep information about line numbers unless we use the -renamesourcefileattribute
and -keepattributes
options as indicated. More information about this here.
These options will increase your apk size a bit, but it's totally worth it. This saved me many headaches analyzing my stacktraces.
Upvotes: 4
Reputation: 96
Better to use Fabrics instead. It will give crash report along with line numbers.
Upvotes: 0