最近在学习反编译,拿一个小apk来练习,反编译后都是些看不懂的if for、if while结构,还带label标签
public Painter(Context paramContext, ViewGroup.LayoutParams paramLayoutParams, Drawable paramDrawable, float paramFloat)
  {
    super(paramContext);
    int i = this.needle.getWidth();
    int j = this.needle.getHeight();
    this.needleCenterX = (i / 2.0F);
    this.needleCenterY = (j / 2.0F);
    int k = this.compass.getWidth();
    int m = this.compass.getHeight();
    int n = k / 2;
    int i1 = m / 2;
    this.needleOffsetX = (n - this.needleCenterX);
    this.needleOffsetY = (i1 - this.needleCenterY);
    if (j > i);
    for (int i2 = j; ; i2 = i)
    {
      (i2 / 2);
      (360000 / CompassActivity.height);
      (216000 / CompassActivity.width);
      (360000 / CompassActivity.height);
      (216000 / CompassActivity.width);
      int i3 = this.background.getWidth();
      int i4 = this.background.getHeight();
      this.bgSrc = new Rect(i3 / 10, (i4 - i4 * (8 * CompassActivity.width) / 10 / CompassActivity.height) / 2, i3 * 9 / 10, (i4 - i4 * (8 * CompassActivity.width) / 10 / CompassActivity.height) / 2 + i4 * (8 * CompassActivity.width) / 10 / CompassActivity.height);
      this.bgDest = new Rect(0, 0, 8 * CompassActivity.width / 10, 8 * CompassActivity.width / 10);
      this.matrix0 = new Matrix();
      this.matrix = new Matrix();
      this.matrix2 = new Matrix();
      this.needlePaint = new Paint();
      this.needlePaint.setFilterBitmap(true);
      paramLayoutParams.width = k;
      paramLayoutParams.height = m;
      setLayoutParams(paramLayoutParams);
      SurfaceHolder localSurfaceHolder = getHolder();
      localSurfaceHolder.setSizeFromLayout();
      localSurfaceHolder.addCallback(this);
      return;
    }
  }private void onPaint(long paramLong, boolean paramBoolean)
  {
    SurfaceHolder localSurfaceHolder = getHolder();
    Canvas localCanvas;
    float f1;
    float f2;
    if (paramBoolean)
    {
      localCanvas = localSurfaceHolder.lockCanvas();
      if (localCanvas != null)
      {
        f1 = this.degrees - this.currentDegrees;
        f2 = this.degrees2 - this.currentDegrees2;
        if (Math.abs(f1) >= 180.0F)
        {
          if (f1 <= 0.0F)
            break label357;
          f1 -= 360.0F;
        }
        label71: if (Math.abs(f2) >= 180.0F)
        {
          if (f2 <= 0.0F)
            break label367;
          f2 -= 360.0F;
        }
        label96: this.currentDegrees = ((float)(this.currentDegrees + 0.08500000000000001D * f1));
        this.currentDegrees2 = ((float)(this.currentDegrees2 + 0.08500000000000001D * f2));
        if (this.currentDegrees < 0.0F)
          break label377;
        if (this.currentDegrees > 360.0F)
          this.currentDegrees -= 360.0F;
        label162: if (this.currentDegrees2 < 0.0F)
          break label391;
        if (this.currentDegrees2 <= 360.0F);
      }
    }
    label391: for (this.currentDegrees2 -= 360.0F; ; this.currentDegrees2 = (360.0F + this.currentDegrees2))
    {
      this.matrix.setRotate(this.currentDegrees, this.needleCenterX, this.needleCenterY);
      this.matrix.postTranslate(this.needleOffsetX, this.needleOffsetY);
      this.matrix2.setRotate(this.degrees2, this.needleCenterX, this.needleCenterY);
      this.matrix2.postTranslate(this.needleOffsetX, this.needleOffsetY);
      localCanvas.drawBitmap(this.background, this.bgSrc, this.bgDest, null);
      localCanvas.drawBitmap(this.needle, this.matrix, this.needlePaint);
      localCanvas.drawBitmap(this.haido, this.matrix0, this.needlePaint);
      localCanvas.drawBitmap(this.compass, this.matrix2, this.needlePaint);
      localSurfaceHolder.unlockCanvasAndPost(localCanvas);
      return;
      localCanvas = localSurfaceHolder.lockCanvas(this.bgDest2);
      break;
      label357: f1 += 360.0F;
      break label71;
      label367: f2 += 360.0F;
      break label96;
      label377: this.currentDegrees = (360.0F + this.currentDegrees);
      break label162;
    }
  }public void surfaceCreated(SurfaceHolder paramSurfaceHolder)
  {
    this.runDrawingThread = true;
    new Thread(new Runnable()
    {
      public void run()
      {
        long l1 = System.currentTimeMillis();
        long l2 = 0L;
        int i = 0;
        if (!Painter.this.runDrawingThread)
          return;
        long l3 = System.currentTimeMillis();
        if (i < 2)
        {
          Painter.this.onPaint(l3, true);
          i++;
        }
        while (true)
        {
          while (true)
          {
            if ((l3 - l2) / 1000L >= 1L)
              l2 = l3;
            l1 += 16L;
            long l4 = l1 - l3;
            if (l4 < 0L)
              break;
            try
            {
              Thread.sleep(l4);
            }
            catch (Exception localException)
            {
            }
          }
          break;
          Painter.this.onPaint(l3, false);
        }
      }
    }).start();
  }

解决方案 »

  1.   

    这个代码是混淆过的,混淆的代码就是为了让你看不懂的,要不然人家工程不都被你抄了??它会将代码中的变量类名等 用  a  b  c  d 这样的方式来表示,很难看明白
      

  2.   

    代码是没有混淆过的,没有将代码中的变量类名等 用  a  b  c  d 这样的方式来表示,只是在反编译时出现逻辑错误,都是if for、if while结构的逻辑错误