Android符号表转换

来源:互联网 发布:ubuntu密码忘记了 编辑:程序博客网 时间:2024/06/05 17:28

   Android中为了保护我们自己辛苦劳作,我们常常会把代码混淆,但是混淆后如果程序出现问题,解崩溃比较麻烦,需要将混淆的log进行解混淆。

  首先我们在混淆代码的时候,会生成一个mapping文件,它是混淆前和混淆后代码的对应表,借助Android的retrace.jar我们就可将解混淆。

 在adb shell 命令下可以使用命令很容易解混淆,但是目前,我需要在Windows、Linux服务上在代码中能够上传符号表在进行解混淆,可以使用这个adb shell命令并不能使用,最后将retrace.jar放在程序中(web应用)调用它的代码可以顺利解混淆。再次分享。如果想深入研究可以看看retrace.jar源码.

public static void ReTrace(String mapFile,String crashFile,String outFile) {try {File file = new File(outFile);FileOutputStream fis = new FileOutputStream(file, false);PrintStream out = new PrintStream(fis);System.setOut(out);proguard.retrace.ReTrace localReTrace = new proguard.retrace.ReTrace(proguard.retrace.ReTrace.STACK_TRACE_EXPRESSION,true, new File(mapFile), new File(crashFile));localReTrace.execute();out.close();fis.close();} catch (IOException e) {System.out.println("转码失败");e.printStackTrace();}}

          

2 0
原创粉丝点击