This is not a bug report but I’m desperate,
My computer got in an accident and my hard drive was wiped, meaning i lost the code to the app i had been working on for 4 months and all copies i made of the code. All i have is the .aab file i uploaded to the google playstore. Is there any method to convert a .aab back into source code? any help is appreciated
Hi @arnav_123
For future reference, you should probably create a free GitHub or GitLab account and upload your code to a private repository.
About your question: The source code is minified and bundled together into a large blob of really ugly and hard to understand JavaScript. So it would be difficult to get back to your source code again. It would be similar to trying to convert a .exe
back into source code, although perhaps not quite as hard as that.
If you rename the .aab
file to .zip
and then unzip it you will see the contents. The JavaScript code is in base/assets/index.android.bundle
. If you open it in a text editor you’ll see it is all bunched together because most of the spaces and newlines have been removed. Also, all the functions and variables will have been renamed to shorter names. Also, the code will include not only your JavaScript, but also all of the JavaScript from your dependencies. In addition, the bundler wraps all of these pieces of JavaScript in such a way that they can’t conflict with each other if e.g. one of your dependencies uses a function of the same name as another dependency. Oh, and all the JSX will be converted to JavaScript too and the import statements will be gone.
To make this a little easier to understand you can pretty print it (e.g. with prettier
or with whatever JavaScript editor/IDE you use.) Unfortunately this doesn’t help that much because it only adds spaces/newlines back without undoing the renaming/wrapping. Also, you might want to first get rid of the code for your dependencies, since each will likely be on one line and you can delete it easily, as opposed to having to delete many multi-line blocks.
So you would have to wade through the code trying to find your code. (Search for strings that appear in your app. e.g. button titles or other text.) Most of the code is wrapped in calls like this:
__d(function(g,r,i,a,m,e,d){/* some code here */},0,[1,2,418,485]);
There will most likely be several of these calls for different parts of your own code and then many more for parts of your dependencies.
Depending on how large your app is, it’s not impossible to reverse engineer this back into usable source code, but it’s not easy.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.