nolan
nolan

Reputation: 490

Extracting Android .apk and reading contents of XML file in res/layout

I am trying to reverse engineer an existing android app and understand how a particular UI is constructed. I've found that I can rename the apk to zip and view some of the compiled source. The res/layout directory is populated with all the xml files that define the UI, but while they do have the xml extension, they are not in XML format. Is there anyway to convert these files back to text based markup?

Upvotes: 33

Views: 69438

Answers (5)

Suraj Gupta
Suraj Gupta

Reputation: 43

For those Who are shortcut lovers: and using ubunto,

go to cmd : ctl+alt+t

type:

sudo apt install apktool

press enter then go to your apk(to decompile) folder. by using

cd ~/folder_name

then type:

apktool d yourAppName.apk

and boom , you are done.

Upvotes: 2

Milad Faridnia
Milad Faridnia

Reputation: 9477

Create a new folder and put the .apk file which you want to decode into that.

Download the latest version of from here.

Open cmd then navigate to the root directory of APKtool and type the following command:

apktool d myApp.apk 

(where myApp.apk is the filename that you want to decode)

now you get a file folder in that folder and can easily read the apk's xml files.

Here is the link for more detail install instructions

Upvotes: 6

pengwang
pengwang

Reputation: 19956

I think you can use android-apktool. The XML files look very well.

Upvotes: 40

success_anil
success_anil

Reputation: 3658

First covert your .apk to .zip. Inside that you will get a compiled-bundled version of java class files called .dex. apply the below trick to convert that dex to class files

There's a way to do this. A slight atypical way is to download this opensource tool dextojar http://code.google.com/p/dex2jar/

This will convert your dex files to Jar file. Unjar these files to get java class files.

Then reverse engineer the java class files to get the java code. Don't use it to break some commercial projects.

Thanks

Upvotes: 0

xesam
xesam

Reputation: 5

if you just want to know the UI construction ,you can use Hierarchy Viewer

Upvotes: -2

Related Questions