How to View Androidmanifest.Xml from APK File

How to view AndroidManifest.xml from APK file?

Yes you can view XML files of an Android APK file. There is a tool for this: android-apktool

It is a tool for reverse engineering 3rd
party, closed, binary Android apps

How to do this on your Windows System:

  1. Download apktool-install-windows-* file
  2. Download apktool-* file
  3. Unpack both to your Windows directory

Now copy the APK file also in that directory and run the following command in your command prompt:

apktool d HelloWorld.apk ./HelloWorld

This will create a directory "HelloWorld" in your current directory. Inside it you can find the AndroidManifest.xml file in decrypted format, and you can also find other XML files inside the "HelloWorld/res/layout" directory.

Here HelloWorld.apk is your Android APK file.

See the below screen shot for more information:
alt text

How to parse the AndroidManifest.xml file inside an .apk package


Use android-apktool

There is an application that reads apk files and decodes XMLs to nearly original form.

Usage:

apktool d Gmail.apk && cat Gmail/AndroidManifest.xml

Check android-apktool for more information

Android Manifest.XML File looks odd and I cannot seem to get it in a readable format

The AndroidManifest.xml file is only XML in the source code. Once you compile the app, it gets compiled into a binary format that is more efficient for the Android platform to read from.

This format is undocumented but there are multiple attempts at reverse engineering the source code, e.g. https://justanapplication.wordpress.com/2011/09/22/android-internals-binary-xml-part-one-example/

Or if all you need is see what's in the manifest, you can simply use aapt2 (shipped as part of Android platform tools) with the command aapt2 dump xmltree app.apk --file AndroidManifest.xml

Encode/Decode AndroidManifest.xml inside APK

You may use apktool again to create a new APK file including your changed AndroidManifest.xml.

First, decompile the APK file:

java -jar apktool.jar decode app.apk app

Then modify the files you want in the app directory and recompile it back into a new APK:

java -jar apktool.jar build app app_new.apk

aapt must be on our PATH or use the --aapt option to specify the location of the executable. Otherwise apktool will fail when rebuilding the APK.

Note: The rebuilt APK is neither signed nor zipaligned, just repackaged. Take a look at this website for details about signing and aligning your new APK.

How to read compiled XML files such as the Android manifest

Try ApkTool

A tool for reverse engineering 3rd party, closed, binary Android apps. It can decode resources to nearly original form and rebuild them after making some modifications; it makes possible to debug smali code step by step. Also it makes working with an app easier because of project-like file structure and automation of some repetitive tasks like building apk, etc.



Related Topics



Leave a reply



Submit