为什么不能从android apk解编译这个方法?

时间:2014-01-24 07:32:07

标签: java android decompiling

我使用dex2jar工具来解压缩apk文件, 所有代码都可以正确解编译,但是这个方法

  // ERROR //
  public void sendPacket(byte[] paramArrayOfByte)
  {
    // Byte code:
    //   0: new 82  android/net/LocalSocket
    //   3: dup
    //   4: invokespecial 83    android/net/LocalSocket:<init>  ()V
    //   7: astore_2
    //   8: aload_2
    //   9: new 85  android/net/LocalSocketAddress
    //   12: dup
    //   13: ldc 87
    //   15: getstatic 93   android/net/LocalSocketAddress$Namespace:FILESYSTEM Landroid/net/LocalSocketAddress$Namespace;
    //   18: invokespecial 96   android/net/LocalSocketAddress:<init>   (Ljava/lang/String;Landroid/net/LocalSocketAddress$Namespace;)V
    //   21: invokevirtual 100  android/net/LocalSocket:connect (Landroid/net/LocalSocketAddress;)V
    //   24: aload_2
    //   25: invokevirtual 104  android/net/LocalSocket:getOutputStream ()Ljava/io/OutputStream;
    //   28: astore 7
    //   30: aload_2
    //   31: invokevirtual 108  android/net/LocalSocket:getInputStream  ()Ljava/io/InputStream;
    //   34: astore 8
    //   36: aload 7
    //   38: aload_1
    //   39: invokevirtual 113  java/io/OutputStream:write  ([B)V
    //   42: aload 7
    //   44: invokevirtual 116  java/io/OutputStream:flush  ()V
    //   47: sipush 128
    //   50: newarray byte
    //   52: astore 9
    //   54: aload 8
    //   56: aload 9
    //   58: invokevirtual 122  java/io/InputStream:read    ([B)I
    //   61: pop
    //   62: new 124    com/qualcomm/logkit/settings/ConfigPacket
    //   65: dup
    //   66: aload 9
    //   68: invokespecial 126  com/qualcomm/logkit/settings/ConfigPacket:<init>    ([B)V
    //   71: astore 11
    //   73: aload 11
    //   75: getfield 130   com/qualcomm/logkit/settings/ConfigPacket:msg_type  B
    //   78: tableswitch    default:+26 -> 104, -127:+50->128, -126:+26->104, -125:+95->173
    //   105: iconst_4
    //   106: invokevirtual 133 java/io/OutputStream:close  ()V
    //   109: aload 8
    //   111: invokevirtual 134 java/io/InputStream:close   ()V
    //   114: aload_2
    //   115: ifnull +7 -> 122
    //   118: aload_2
    //   119: invokevirtual 135 android/net/LocalSocket:close   ()V
    //   122: aload_0
    //   123: iconst_0
    //   124: putfield 18   com/qualcomm/logkit/settings/UnixSocketSendThread:isRunning Z
    //   127: return
    //   128: aload 11
    //   130: getfield 139  com/qualcomm/logkit/settings/ConfigPacket:logConfig Lcom/qualcomm/logkit/settings/ConfigPacket$qlog_conf;
    //   133: getfield 144  com/qualcomm/logkit/settings/ConfigPacket$qlog_conf:filter_str  [B
    //   136: invokestatic 150  com/qualcomm/logkit/utils/UtilsStringOperation:byteToString ([B)Ljava/lang/String;
    //   139: invokestatic 152  com/qualcomm/logkit/settings/UnixSocketSendThread:logd  (Ljava/lang/Object;)V
    //   142: goto -38 -> 104
    //   145: astore 5
    //   147: aload 5
    //   149: invokestatic 154  com/qualcomm/logkit/settings/UnixSocketSendThread:loge  (Ljava/lang/Object;)V
    //   152: aload_2
    //   153: ifnull -31 -> 122
    //   156: aload_2
    //   157: invokevirtual 135 android/net/LocalSocket:close   ()V
    //   160: goto -38 -> 122
    //   163: astore 6
    //   165: aload 6
    //   167: invokestatic 154  com/qualcomm/logkit/settings/UnixSocketSendThread:loge  (Ljava/lang/Object;)V
    //   170: goto -48 -> 122
    //   173: aload 11
    //   175: getfield 158  com/qualcomm/logkit/settings/ConfigPacket:logGlobalConfig   Lcom/qualcomm/logkit/settings/ConfigPacket$qlog_global_conf;
    //   178: getfield 163  com/qualcomm/logkit/settings/ConfigPacket$qlog_global_conf:log_path [B
    //   181: invokestatic 152  com/qualcomm/logkit/settings/UnixSocketSendThread:logd  (Ljava/lang/Object;)V
    //   184: goto -80 -> 104
    //   187: astore_3
    //   188: aload_2
    //   189: ifnull +7 -> 196
    //   192: aload_2
    //   193: invokevirtual 135 android/net/LocalSocket:close   ()V
    //   196: aload_3
    //   197: athrow
    //   198: astore 12
    //   200: aload 12
    //   202: invokestatic 154  com/qualcomm/logkit/settings/UnixSocketSendThread:loge  (Ljava/lang/Object;)V
    //   205: goto -83 -> 122
    //   208: astore 4
    //   210: aload 4
    //   212: invokestatic 154  com/qualcomm/logkit/settings/UnixSocketSendThread:loge  (Ljava/lang/Object;)V
    //   215: goto -19 -> 196
    //
    // Exception table:
    //   from   to  target  type
    //   8  114 145 java/io/IOException
    //   128    142 145 java/io/IOException
    //   173    184 145 java/io/IOException
    //   156    160 163 java/io/IOException
    //   8  114 187 finally
    //   128    142 187 finally
    //   147    152 187 finally
    //   173    184 187 finally
    //   118    122 198 java/io/IOException
    //   192    196 208 java/io/IOException
  }

怎么了?

2 个答案:

答案 0 :(得分:3)

  

怎么了?

没有错。反编译器经常遇到代码太复杂或者被混淆的问题(故意难以反编译......)

你能做些什么?并不多......除了用手反编译自己的代码。 (但这并不容易。首先,您需要弄清楚异常处理的范围,并重新创建try / catch / finally块。)

答案 1 :(得分:1)

它或者只是反编译器的限制,或者可能是这种方法被混淆了。虽然,通常整个.apks都是混淆的,而不仅仅是一种方法。也许如果你说这是哪个.apk,那就更有可能提出答案。