从 APK 反编译代码更改代码

Decompiling code from APK changed code

我最近不得不从我的计算机上卸载 Android Studio,它删除了我所有的项目文件,幸运的是我还有一个来自最新版本的 APK,并且能够正确地反编译代码。我所有的文件都在那里,我已经能够通过记事本看到 java class 代码,但看起来代码中的某些内容已更改。当我将项目导入回 Android Studio 时,它们会变回来吗?这是我的主要示例 activity.

public class MainActivity
  extends AppCompatActivity
{
  private static final String TAG = MainActivity.class.getName();
  private static final String hasUserRatedAppKey = "hasUserRatedApp";
  private static final String settingsKey = "MyAppSettings";
  private String SENDER_ID = "993190397898";
  private CustomAdapter adapter;
  Fragment fragment;
  private DrawerLayout mDrawerLayout;
  private ListView mDrawerList;
  private CharSequence mDrawerTitle;
  private ActionBarDrawerToggle mDrawerToggle;
  private CharSequence mTitle;
  String[] menutitles;
  private List<RowItem> rowItems;

  private void selectItem(int paramInt)
  {
    switch (paramInt)
    {
    }
    for (;;)
    {
      this.mDrawerList.setItemChecked(paramInt, true);
      setTitle("Converjz");
      this.mDrawerLayout.closeDrawer(this.mDrawerList);
      return;
      startActivity(new Intent(this, MainActivity.class));
      finish();
      continue;
      startActivity(new Intent(this, Time.class));
      finish();
      continue;
      startActivity(new Intent(this, Temperature.class));
      finish();
      continue;
      startActivity(new Intent(this, Weight.class));
      finish();
      continue;
      startActivity(new Intent(this, Length.class));
      finish();
      continue;
      startActivity(new Intent(this, Money.class));
      finish();
      continue;
      startActivity(new Intent(this, Metric.class));
      finish();
      continue;
      startActivity(new Intent(this, Food.class));
      finish();
      continue;
      startActivity(new Intent(this, Data.class));
      finish();
      continue;
      startActivity(new Intent(this, Frequency.class));
      finish();
      continue;
      startActivity(new Intent(this, Numeral.class));
      finish();
    }
  }

  public void onConfigurationChanged(Configuration paramConfiguration)
  {
    super.onConfigurationChanged(paramConfiguration);
    this.mDrawerToggle.onConfigurationChanged(paramConfiguration);
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130968609);
    paramBundle = ((AnalyticsTracker)getApplication()).getTracker(AnalyticsTracker.TrackerName.APP_TRACKER);
    paramBundle.enableAdvertisingIdCollection(true);
    paramBundle.setScreenName("Home");
    paramBundle.send(new HitBuilders.AppViewBuilder().build());
    this.menutitles = getResources().getStringArray(2131558424);
    this.mDrawerLayout = ((DrawerLayout)findViewById(2131689566));
    this.mDrawerList = ((ListView)findViewById(2131689573));
    this.mDrawerList.setAdapter(new ArrayAdapter(this, 2130968608, 2131689522, this.menutitles));
    paramBundle = getTitle();
    this.mDrawerTitle = paramBundle;
    this.mTitle = paramBundle;
    this.mDrawerList.setOnItemClickListener(new DrawerItemClickListener(null));
    this.mDrawerToggle = new ActionBarDrawerToggle(this, this.mDrawerLayout, 2131230781, 2131230780)
    {
      public void onDrawerClosed(View paramAnonymousView)
      {
        super.onDrawerClosed(paramAnonymousView);
        MainActivity.this.getSupportActionBar().setTitle(MainActivity.this.mTitle);
        MainActivity.this.invalidateOptionsMenu();
      }

      public void onDrawerOpened(View paramAnonymousView)
      {
        super.onDrawerOpened(paramAnonymousView);
        MainActivity.this.getSupportActionBar().setTitle(MainActivity.this.mDrawerTitle);
        MainActivity.this.invalidateOptionsMenu();
      }
    };
    this.mDrawerLayout.setDrawerListener(this.mDrawerToggle);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    getResources().getConfiguration();
    getFragmentManager().beginTransaction().replace(16908290, new adView());
    ((AdView)findViewById(2131689565)).loadAd(new AdRequest.Builder().build());
    paramBundle = (Button)findViewById(2131689593);
    final ObjectAnimator localObjectAnimator = ObjectAnimator.ofPropertyValuesHolder((RelativeLayout)findViewById(2131689592), new PropertyValuesHolder[] { PropertyValuesHolder.ofFloat("scaleX", new float[] { 1.2F }), PropertyValuesHolder.ofFloat("scaleY", new float[] { 1.2F }) });
    localObjectAnimator.setRepeatCount(-1);
    localObjectAnimator.setRepeatMode(2);
    paramBundle.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        localObjectAnimator.start();
        new Handler().postDelayed(new Runnable()
        {
          public void run()
          {
            Intent localIntent = new Intent(MainActivity.this, Metric.class);
            MainActivity.this.startActivity(localIntent);
            MainActivity.this.finish();
          }
        }, 500L);
      }
    });
    paramBundle = (Button)findViewById(2131689580);
    localObjectAnimator = ObjectAnimator.ofPropertyValuesHolder((RelativeLayout)findViewById(2131689579), new PropertyValuesHolder[] { PropertyValuesHolder.ofFloat("scaleX", new float[] { 1.2F }), PropertyValuesHolder.ofFloat("scaleY", new float[] { 1.2F }) });
    localObjectAnimator.setRepeatCount(-1);
    localObjectAnimator.setRepeatMode(2);
    paramBundle.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        localObjectAnimator.start();
        new Handler().postDelayed(new Runnable()
        {
          public void run()
          {
            Intent localIntent = new Intent(MainActivity.this, Time.class);
            MainActivity.this.startActivity(localIntent);
            MainActivity.this.finish();
          }
        }, 500L);
      }
    });
    paramBundle = (Button)findViewById(2131689583);
    localObjectAnimator = ObjectAnimator.ofPropertyValuesHolder((RelativeLayout)findViewById(2131689581), new PropertyValuesHolder[] { PropertyValuesHolder.ofFloat("scaleX", new float[] { 1.2F }), PropertyValuesHolder.ofFloat("scaleY", new float[] { 1.2F }) });
    localObjectAnimator.setRepeatCount(-1);
    localObjectAnimator.setRepeatMode(2);
    paramBundle.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        localObjectAnimator.start();
        new Handler().postDelayed(new Runnable()
        {
          public void run()
          {
            Intent localIntent = new Intent(MainActivity.this, Temperature.class);
            MainActivity.this.startActivity(localIntent);
            MainActivity.this.finish();
          }
        }, 500L);
      }
    });
    paramBundle = (Button)findViewById(2131689585);
    localObjectAnimator = ObjectAnimator.ofPropertyValuesHolder((RelativeLayout)findViewById(2131689584), new PropertyValuesHolder[] { PropertyValuesHolder.ofFloat("scaleX", new float[] { 1.2F }), PropertyValuesHolder.ofFloat("scaleY", new float[] { 1.2F }) });
    localObjectAnimator.setRepeatCount(-1);
    localObjectAnimator.setRepeatMode(2);
    paramBundle.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        localObjectAnimator.start();
        new Handler().postDelayed(new Runnable()
        {
          public void run()
          {
            Intent localIntent = new Intent(MainActivity.this, Weight.class);
            MainActivity.this.startActivity(localIntent);
            MainActivity.this.finish();
          }
        }, 500L);
      }
    });
    paramBundle = (Button)findViewById(2131689589);
    localObjectAnimator = ObjectAnimator.ofPropertyValuesHolder((RelativeLayout)findViewById(2131689586), new PropertyValuesHolder[] { PropertyValuesHolder.ofFloat("scaleX", new float[] { 1.2F }), PropertyValuesHolder.ofFloat("scaleY", new float[] { 1.2F }) });
    localObjectAnimator.setRepeatCount(-1);
    localObjectAnimator.setRepeatMode(2);
    paramBundle.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        localObjectAnimator.start();
        new Handler().postDelayed(new Runnable()
        {
          public void run()
          {
            Intent localIntent = new Intent(MainActivity.this, Length.class);
            MainActivity.this.startActivity(localIntent);
            MainActivity.this.finish();
          }
        }, 500L);
      }
    });
    paramBundle = (Button)findViewById(2131689591);
    localObjectAnimator = ObjectAnimator.ofPropertyValuesHolder((RelativeLayout)findViewById(2131689574), new PropertyValuesHolder[] { PropertyValuesHolder.ofFloat("scaleX", new float[] { 1.2F }), PropertyValuesHolder.ofFloat("scaleY", new float[] { 1.2F }) });
    localObjectAnimator.setRepeatCount(-1);
    localObjectAnimator.setRepeatMode(2);
    paramBundle.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        localObjectAnimator.start();
        new Handler().postDelayed(new Runnable()
        {
          public void run()
          {
            Intent localIntent = new Intent(MainActivity.this, Money.class);
            MainActivity.this.startActivity(localIntent);
            MainActivity.this.finish();
          }
        }, 500L);
      }
    });
    paramBundle = (Button)findViewById(2131689597);
    localObjectAnimator = ObjectAnimator.ofPropertyValuesHolder((RelativeLayout)findViewById(2131689596), new PropertyValuesHolder[] { PropertyValuesHolder.ofFloat("scaleX", new float[] { 1.2F }), PropertyValuesHolder.ofFloat("scaleY", new float[] { 1.2F }) });
    localObjectAnimator.setRepeatCount(-1);
    localObjectAnimator.setRepeatMode(2);
    paramBundle.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        localObjectAnimator.start();
        new Handler().postDelayed(new Runnable()
        {
          public void run()
          {
            Intent localIntent = new Intent(MainActivity.this, Food.class);
            MainActivity.this.startActivity(localIntent);
            MainActivity.this.finish();
          }
        }, 500L);
      }
    });
    paramBundle = (Button)findViewById(2131689599);
    localObjectAnimator = ObjectAnimator.ofPropertyValuesHolder((RelativeLayout)findViewById(2131689598), new PropertyValuesHolder[] { PropertyValuesHolder.ofFloat("scaleX", new float[] { 1.2F }), PropertyValuesHolder.ofFloat("scaleY", new float[] { 1.2F }) });
    localObjectAnimator.setRepeatCount(-1);
    localObjectAnimator.setRepeatMode(2);
    paramBundle.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        localObjectAnimator.start();
        new Handler().postDelayed(new Runnable()
        {
          public void run()
          {
            Intent localIntent = new Intent(MainActivity.this, Data.class);
            MainActivity.this.startActivity(localIntent);
            MainActivity.this.finish();
          }
        }, 500L);
      }
    });
    paramBundle = (Button)findViewById(2131689602);
    localObjectAnimator = ObjectAnimator.ofPropertyValuesHolder((RelativeLayout)findViewById(2131689600), new PropertyValuesHolder[] { PropertyValuesHolder.ofFloat("scaleX", new float[] { 1.2F }), PropertyValuesHolder.ofFloat("scaleY", new float[] { 1.2F }) });
    localObjectAnimator.setRepeatCount(-1);
    localObjectAnimator.setRepeatMode(2);
    paramBundle.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        localObjectAnimator.start();
        new Handler().postDelayed(new Runnable()
        {
          public void run()
          {
            Intent localIntent = new Intent(MainActivity.this, Frequency.class);
            MainActivity.this.startActivity(localIntent);
            MainActivity.this.finish();
          }
        }, 500L);
      }
    });
    paramBundle = (Button)findViewById(2131689605);
    localObjectAnimator = ObjectAnimator.ofPropertyValuesHolder((RelativeLayout)findViewById(2131689604), new PropertyValuesHolder[] { PropertyValuesHolder.ofFloat("scaleX", new float[] { 1.2F }), PropertyValuesHolder.ofFloat("scaleY", new float[] { 1.2F }) });
    localObjectAnimator.setRepeatCount(-1);
    localObjectAnimator.setRepeatMode(2);
    paramBundle.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        localObjectAnimator.start();
        new Handler().postDelayed(new Runnable()
        {
          public void run()
          {
            Intent localIntent = new Intent(MainActivity.this, Numeral.class);
            MainActivity.this.startActivity(localIntent);
            MainActivity.this.finish();
          }
        }, 500L);
      }
    });
  }

  public boolean onCreateOptionsMenu(Menu paramMenu)
  {
    getMenuInflater().inflate(2131755008, paramMenu);
    return true;
  }

  public boolean onOptionsItemSelected(MenuItem paramMenuItem)
  {
    if (this.mDrawerToggle.onOptionsItemSelected(paramMenuItem)) {
      return true;
    }
    switch (paramMenuItem.getItemId())
    {
    }
    for (;;)
    {
      return super.onOptionsItemSelected(paramMenuItem);
      startActivity(new Intent(this, About.class));
      continue;
      Object localObject = new Intent("android.intent.action.VIEW", Uri.parse("https://play.google.com/store/apps/details?id=com.TechnologyForTomorrow.Converjz"));
      try
      {
        startActivity((Intent)localObject);
        localObject = ((AnalyticsTracker)getApplication()).getTracker(AnalyticsTracker.TrackerName.APP_TRACKER);
        ((Tracker)localObject).enableAdvertisingIdCollection(true);
        ((Tracker)localObject).setScreenName("EULA");
        ((Tracker)localObject).send(new HitBuilders.AppViewBuilder().build());
      }
      catch (ActivityNotFoundException localActivityNotFoundException) {}
      continue;
      startActivity(new Intent(this, EULA.class));
    }
  }

  protected void onPostCreate(Bundle paramBundle)
  {
    super.onPostCreate(paramBundle);
    this.mDrawerToggle.syncState();
  }

  public boolean onPrepareOptionsMenu(Menu paramMenu)
  {
    this.mDrawerLayout.isDrawerOpen(this.mDrawerList);
    return super.onPrepareOptionsMenu(paramMenu);
  }

  public void setTitle(CharSequence paramCharSequence)
  {
    this.mTitle = paramCharSequence;
    getSupportActionBar().setTitle(this.mTitle);
  }

  private class DrawerItemClickListener
    implements AdapterView.OnItemClickListener
  {
    private DrawerItemClickListener() {}

    public void onItemClick(AdapterView paramAdapterView, View paramView, int paramInt, long paramLong)
    {
      MainActivity.this.selectItem(paramInt);
    }
  }
}


/* Location:              C:\Noah's stuff\dex2jar-2.0\Converjz-dex2jar.jar!\course\labs\converjz\MainActivity.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */

Will they change back when I import the project back into the Android Studio?

没有,因为没有"back"。 Android Studio 不知道这不是您想要的代码。

这就是为什么您不应该反编译 APK,而应该从您的计算机备份或版本控制系统中恢复您的项目。

当然欢迎您找到其他反编译器,看看它是否能提供更符合您喜好的结果。我建议您在为您的计算机设置每晚备份方案后执行此操作。