Proguard will return missing line numbers

I am trying to disable stack trace from my android app. I used proguard when building the application and working backwards seems to work, more or less.

What doesn't work is decoding line numbers. The output does not display line numbers and lists several options for each "in".

Here is my proguard-project.txt file:

-keepattributes LineNumberTable -assumenosideeffects class android.util.Log { public static int v(...); public static int d(...); } 

This is my stack trace:

 uncaught exception java.lang.NullPointerException at com.myapp.myapp.dbaccess.ag.a(Unknown Source) at com.myuapp.myapp.dbaccess.xa(Unknown Source) at com.myapp.myapp.dbaccess.xa(Unknown Source) at com.myapp.myapp.main.ab.run(Unknown Source) 

And here is the conclusion:

 uncaught exception java.lang.NullPointerException at com.myapp.myapp.dbaccess.ZNodeCache.com.myapp.myapp.dbaccess.ZNode getNodeFromCache(long)(Unknown Source) com.myapp.myapp.dbaccess.ZRoot getRootFromCache() com.myapp.myapp.dbaccess.ZNode getNodeFromDb(long,boolean) com.myapp.myapp.dbaccess.ZNode$Array getChildrenForExport(com.myapp.myapp.dbaccess.ZNode) ... many more ... at com.myapp.myapp.dbaccess.XmlImport.com.myapp.myapp.dbaccess.XmlImport$Results importFile(java.lang.String)(Unknown Source) void _doImport(java.io.InputStream,com.myapp.myapp.dbaccess.XmlImport$Results) void importFile(java.io.InputStream) void importNode(org.xmlpull.v1.XmlPullParser,com.myapp.myapp.dbaccess.ZNode) ... many more ... at com.myapp.myapp.dbaccess.XmlImport.com.myapp.myapp.dbaccess.XmlImport$Results importFile(java.lang.String)(Unknown Source) void _doImport(java.io.InputStream,com.myapp.myapp.dbaccess.XmlImport$Results) void importFile(java.io.InputStream) void importNode(org.xmlpull.v1.XmlPullParser,com.myapp.myapp.dbaccess.ZNode) ... many more ... at com.myapp.myapp.main.MainActivity$3.void run()(Unknown Source) 

I need to miss another configuration option; any ideas?

+6
source share
1 answer

It turns out the answer is in the Android documentation (believe it or not). I guess I missed it the first time. You need to specify the source file, for example:

 -renamesourcefileattribute SourceFile -keepattributes SourceFile,LineNumberTable 

The renamsesourcefile property will cause all source files to be named SourceFile (or whatever you put). "retrace" does not care about what the name of the source file is, but if you leave it alone, it will decide to ignore line numbers.

This goes to proguard-project.txt, which if you use Android Studio, you will find in your project .app.

+23
source

All Articles