12

Hey i have this issue where I first created an app, put it on playstore and then i tried to integrate google adsense into it later. I had to change some code in the build file which has now completely ruined my project and i can't even revert back my changes since i had closed android studio.

I've spent hours trying to fix the code but it just wouldnt work. I need to see what have i done wrong. In the previous version it was working fine. Is there any way to see the code in the previous apk? or reset changes or anything like that in android studio?

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
AxeManTOBO
  • 487
  • 1
  • 4
  • 17

3 Answers3

21

Android Studio has a code history feature which allows you to see previous versions of a corresponding file. Just right click on a file in the IDE's file explorer and you will see this option.

Ukubu
  • 810
  • 1
  • 6
  • 18
14

Right click the file in android studio, Local History -> Show History. Maybe you can see old version of file.

If not, here is the certain solution: download old apk from Play store, use Dex2jar to decompile old .dex file and see codes with JD-GUI.

Or you can use Jadx too.

Ozgur
  • 3,738
  • 17
  • 34
1

You could try googling for an .apk decompiler and try to decompile your old .apk. You may get mixed results but if you are desperate that is one option.

But from now on, make sure to use git for source control in your apps. Android Studio makes it really easy to use git.

Micro
  • 10,303
  • 14
  • 82
  • 120