I have here a stack trace from one of my games from android market. I have de-proguarded it but I can't really understand it!
I'm not asking for help in the error itself, but just how to interpret this.
I started with this from Market:
java.lang.IllegalArgumentException
at java.nio.Buffer.position(Buffer.java:299)
at com.a.a.k.o.a(Unknown Source)
at com.a.a.k.w.a(Unknown Source)
at com.a.a.k.w.onDrawFrame(Unknown Source)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1363)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
But retrace.bat has output this, which is longer, so I can't tell what com.a.a.k.o.a is (for exmaple).
java.lang.IllegalArgumentException
at java.nio.Buffer.position(Buffer.java:299)
at com.eaw.graphics.WorldViewShader.void glSetMVPMatrix(float[])(Unknown Source)
void glSetNormalMatrix(com.eaw.graphics.AMatrix)
void SetVertices(java.nio.FloatBuffer)
void ApplyArgs(com.eaw.graphics.WorldViewShaderArgs)
at com.eaw.graphics.TriangleRenderer.void onDrawFrame(com.eaw.airrace.ILayer,com.eaw.airrace.StepOutput,boolean)(Unknown Source)
void loadTexture$332cd44f(int[],int,int)
void delayedLoadTexture(int[],int[],int,int)
at com.eaw.graphics.TriangleRenderer.void onDrawFrame(javax.microedition.khronos.opengles.GL10)(Unknown Source)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1363)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
Has it rolled 4 functions into 1 during obscuration? or what?
You should add -keepattributes SourceFile,LineNumberTable to your proguard configuration file!
Your processed code and stack trace doesn't contain line numbers, so ProGuard can't tell to which original method name the obfuscated method name 'a' corresponds. It then prints out all possible alternatives. Cfr. ProGuard's Retrace manual.
The manual also documents how you can preserve line numbers in the obfuscation step.
Related
After adding a jar file containing some functionality that I need to my application, my proguard build hasn't been working. the error message I get after running my proguard build is:
Warning: Exception while processing task java.io.IOException: java.lang.RuntimeException: Unexpected error while writing class [proguard/optimize/gson/_OptimizedTypeAdapterFactory] (Overflow of unsigned short value [93362])
Thread(Tasks limiter_1): destruction
Is there any way to exclude that jar file from being checked by ProGuard? I'm using ProGuard v6.2.2. I suspected the issue would be GSON since i had issues with it before this error.
I've also checked and researched answers here such as Proguard [ java.lang.IllegalArgumentException: Overflow of unsigned short value ]
Android crash while using GSON Library and ProGuard
#732 Exception while handling very long string argument
Any help would be appreciated.
You can read more about ProGuard configuration and optimizations here:
https://www.guardsquare.com/en/products/proguard/manual/usage/optimizations
but in your case you can exclude the gson library that is throwing the exception like this:
-optimizations !library/gson
That's a known bug. Until this had been rectified, you can only disable the code optimization:
-optimizations !code/simplification/string
Or disable optimization altogether with -dontoptimize. Or just use R8 instead ...
That one linked answer which suggests a version-downgrade might also work.
I have an app that I have recently submitted to the play store. I had tested the .apk file and everything was working fine. On the first install (from the store) - you can login but then it crashes. Here is the stack trace I am getting from the report:
java.lang.NullPointerException
at com.latlon.InitialSearchActivity.e(Unknown Source)
at com.latlon.InitialSearchActivity.a(Unknown Source)
at com.latlon.InitialSearchActivity.g(Unknown Source)
at com.latlon.InitialSearchActivity.a(Unknown Source)
at com.latlon.MyResultReceiver.onReceiveResult(Unknown Source)
at android.os.ResultReceiver$MyRunnable.run(ResultReceiver.java:43)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4385)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
at dalvik.system.NativeStart.main(Native Method)
I am just not real sure where to start looking. Any ideas?
Well, this part of the stack trace is your code:
java.lang.NullPointerException
at com.latlon.InitialSearchActivity.e(Unknown Source)
at com.latlon.InitialSearchActivity.a(Unknown Source)
at com.latlon.InitialSearchActivity.g(Unknown Source)
at com.latlon.InitialSearchActivity.a(Unknown Source)
at com.latlon.MyResultReceiver.onReceiveResult(Unknown Source)
Your onReceiveResult() method in class MyResultReceiver was called. That method called a method a in the InitialSearchActivity class, which called a method g in that class which called a method a in that class which called a method e in that class. In method e there was a NullPointerException (ie: in that method you tried to use a variable that you thought contained an object reference, but instead that variable contained null.
It looks like the method names have been obfuscated, so you may have to look at the code to figure out what the real method names are.
Looks like you used some toole (like Proguard) to obfuscate your code.
Did you test your APK after obfuscation?
From the logs above a NullPointerException has occured in your code, you'd need to de-obfuscate your code using the key files generated by the obfuscating tool in order to find out the real place (line of code) where null pointer has been accessed.
Please Note,
In the process of obfuscation, sometimes (human error) can cause some of the required methods to be obfuscated. Which in turn causes those methods not to be found, hence an exception (NoSuchMethod) might be raised.
Check the documentation on Proguard (which is the tool that does the code obfusciation).
It is very likely that you "over-obfusciated", which can cause issues with the deployed code. Just like you are seeing.
You can turn off Proguard functionality by editing the "proguard-project.txt" file. To ensure no obfusciation occurs, make sure every line in this file is commented out (by placing a hash - or # mark at the start of each line).
There is a command called retrace that allows you to provide unmap your obfusciation. You will need to provide some files created by proguard to get this working.
Check the docs for full explanation: http://developer.android.com/tools/help/proguard.html
Quick fix (to eliminate Proguard) is to comment the file, so it doesn't run in the first place.
I need some help with Android log file deobfuscation .
The problem is that if I have an exception like:
...
10-16 10:03:10.488: E/AndroidRuntime(25723): Caused by: java.lang.NullPointerException
10-16 10:03:10.488: E/AndroidRuntime(25723): at proguard.test.a.a(Unknown Source)
...
the retrace return original log but if I paste to log function name and line like:
...
10-16 10:03:10.480: I/ghghghg(25723): Crash in function [proguard.test.a.a() Line : -1 ]
...
the retrace doesn't deofescates that log line.
I know that there is an -regex parameter to retrace command but I can't find any explanation or sample. The Proguard retrace manual is unavailable on http://proguard.sourceforge.net/manual/retrace/usage.html.
How can I configure the retrace to deobfuscate custom lines in log?
The ProGuard manual (online, and also included in the ProGuard distribution) contains an example. It uses java.util.regex syntax with some additional wildcards for class names, etc.
You can try recat. It's a python script based on logcat-color, made exactly for this scenario, on-the-fly logcat deobfuscation (doesn't work on Windows though).
I am struggling to understand debug information supplied by retrace.sh on my Android app. Why does it show 2 methods?
at java.lang.Thread.run(Thread.java:1027) Caused by: java.lang.NullPointerException
at com.mytaxicontrol.MyTaxiControlActivity$calctarif.java.lang.Void doInBackground$10299ca()(Unknown Source)
void nexttariflimit(boolean,boolean)
boolean newtaximoved(int,com.mytaxicontrol.MyTaxiControlActivity$nTW)
at com.mytaxicontrol.MyTaxiControlActivity$calctarif.java.lang.Object doInBackground(java.lang.Object[])(Unknown Source)
For lack of line numbers in the stack trace, ReTrace can't determine the original methods unambiguously, so it prints out all possible alternatives.
Cfr. ProGuard manual > ReTrace manual > Examples
Cfr. ProGuard manual > Examples > Producing useful obfuscated stack traces
I got a crash in my app after using Proguard and signing and exporting with a new key.
The same code works in normal eclipse debug mode.
I read everywhere i should use the mapping.txt to find the code that failed.
But how to do that, I have google this for 2 hour now and no answer is working.
Im now signing the apk file with the debug.keystore and using the default password "android".
Someone say i should android:debuggable="false" in my application tag to make
Proguard obfuscate my debug session in eclipse.
Is this right?
Any help would be grate
on the Proguard Android Developer page I cannot find a way to do this
"When your obfuscated code outputs a stack trace, the method names are obfuscated, which makes debugging ha"
What "stack trace" and from where?
On the page Proguard Manual I cannot find an explanation
You can de-obfuscate the stack trace most easily using the Proguard GUI. You'll find this with your Android SDK.
sdk\tools\proguard\bin\proguardgui.bat
Run the GUI above from the path above.
Click the 'ReTrace' button at the bottom of the panel on the left.
Add the path to your Mapping File (mapping.txt) in the 'Mapping file' text box.
Paste a copy of your stack trace in the 'Obfuscated stack trace' text box.
Click 'ReTrace' in the bottom right.
Happy Debugging!
Not within Eclipse.
Outside of Eclipse, use Retrace function within ProGuard. You'll also need the dumped stacktrace and mapping.txt found under your project's proguard directory to reverse the obfuscated stacktrace. Remember to save a copy of mapping.txt (preferably outside of your project's workspace) each time you deploy a new version of your Android app.
Been looking into this, the documentation for proguard on the android developer site demonstrates how to decode a stack trace, but it does not specify how to get the stack trace.
http://developer.android.com/guide/developing/tools/proguard.html (see section Decoding Obfuscated Stack Traces)
I tried to use a logcat dump as follows:-
E/AndroidRuntime(14584): FATAL EXCEPTION: main
E/AndroidRuntime(14584): java.lang.ExceptionInInitializerError
E/AndroidRuntime(14584): at com.a.a.b.a.dg.<init>(Unknown Source)
E/AndroidRuntime(14584): at com.a.a.b.a.q.a(Unknown Source)
E/AndroidRuntime(14584): at com.a.a.b.a.y.a(Unknown Source)
E/AndroidRuntime(14584): at com.a.a.b.a.y.a(Unknown Source)
E/AndroidRuntime(14584): at com.a.a.b.a.aq.get(Unknown Source)
E/AndroidRuntime(14584): at com.a.a.b.cp.a(Unknown Source)
E/AndroidRuntime(14584): at com.a.a.b.ai.c(Unknown Source)
E/AndroidRuntime(14584): at com.a.a.b.bg.a(Unknown Source)
E/AndroidRuntime(14584): at com.a.a.a.o.a(Unknown Source)
E/AndroidRuntime(14584): at com.a.a.b.ee.a(Unknown Source)
E/AndroidRuntime(14584): at com.a.a.b.ag.a(Unknown Source)
E/AndroidRuntime(14584): at com.a.a.b.cb.a(Unknown Source)
Unfortunately this does not work, but it does work if I remove the E/AndroidRuntime(14584) from the beginning of each line it does work:
FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at com.a.a.b.a.dg.<init>(Unknown Source)
at com.a.a.b.a.q.a(Unknown Source)
at com.a.a.b.a.y.a(Unknown Source)
at com.a.a.b.a.y.a(Unknown Source)
at com.a.a.b.a.aq.get(Unknown Source)
at com.a.a.b.cp.a(Unknown Source)
at com.a.a.b.ai.c(Unknown Source)
at com.a.a.b.bg.a(Unknown Source)
at com.a.a.a.o.a(Unknown Source)
at com.a.a.b.ee.a(Unknown Source)
at com.a.a.b.ag.a(Unknown Source)
at com.a.a.b.cb.a(Unknown Source)
So as the documentation states you need a stack trace file, and there appears to be no indication of getting a valid stack trace file from the device.
The only way I have seen this done is by providing a custom exception handler and writing the stack trace to the sdcard.
For mac user use bellow code to run the
/Users/XYZ/Library/Android/sdk/tools/proguard/bin/proguardgui.sh
Run the GUI above from the path above.
Click the 'ReTrace' button at the bottom of the panel on the left.
Add the path to your Mapping File (mapping.txt) in the 'Mapping
file' text box.
Paste a copy of your stack trace in the 'Obfuscated stack trace'
text box. Click
'ReTrace' in the bottom right.
Happy Debugging!
Steps to get obfuscated apk:
Download latest proguard from proguard site. Current latest version is proguard4.7
Replace "bin" and "lib" folder of C:\Program Files (x86)\Android\android-sdk\tools\proguard with latest downloaded proguard folders.
Check SDK location in eclipse for blank spaces in it and for that go to Window > Preferences > Android. If there is blank space then replace it with:
c:\Progra~2\android\android-sdk (for windows 64-bit)
c:\Progra~1\android\android-sdk (for windows 32-bit)
Check that proguard.cfg file is in your project's root folder and add proguard.config=proguard.cfg in project.properties file of android project.
Now export your project to get obfuscated apk.