How to Decode Binary AndroidManifest.xml to Text ?

If you have some prebuilt android application apk for which you need to know what are the services, activities or permissions this apk is using. You can do this by decoding the binary AndroidManifest.xml after extracting the apk.

We have demonstated how we can do this by using MyTestApp.apk as below,

$ unzip MyTestApp.apk

Once this apk, is extracted it contains binary AndroidManifest.xml file as we can check below,

$ file AndroidManifest.xml 
AndroidManifest.xml: Android binary XML

Since this is binary XML, we can’t open this for reading hence we need to convert this to human readable format. For this we will be using AXMLPrinter2.jar which can be downloaded from https://code.google.com/archive/p/android4me/downloads , download and copy this to the directory where we extracted the apk,

$ cp ~/Downloads/AXMLPrinter2.jar .
$ java -jar AXMLPrinter2.jar AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:versionCode="1"
	android:versionName="1.0"
	android:compileSdkVersion="28"
	android:compileSdkVersionCodename="9"
	package="com.example.myapplication"
	platformBuildVersionCode="28"
	platformBuildVersionName="9"
	>
	<uses-sdk
		android:minSdkVersion="15"
		android:targetSdkVersion="28"
		>
	</uses-sdk>
	<application
		android:theme="@7F0C0005"
		android:label="@7F0B0027"
		android:icon="@7F0A0000"
		android:debuggable="true"
		android:allowBackup="true"
		android:supportsRtl="true"
		android:roundIcon="@7F0A0001"
		android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
		>
		<activity
			android:name="com.example.myapplication.MainActivity"
			>
			<intent-filter
				>
				<action
					android:name="android.intent.action.MAIN"
					>
				</action>
				<category
					android:name="android.intent.category.LAUNCHER"
					>
				</category>
			</intent-filter>
		</activity>
	</application>
</manifest>

As we can see above, the command “java -jar AXMLPrinter2.jar AndroidManifest.xml” prints the xml files data on terminal. This can be saved to file as,

$ java -jar AXMLPrinter2.jar AndroidManifest.xml > AndroidManifest.xml.txt 
100% error solved | Error while mer... x
100% error solved | Error while merging dex archives - Multi Dex Enable true.

Leave a Comment

Sign up to our newsletter!

ADB Commands Android Android Applications Android Build system Application Libraries Application Stack / User Interface Bash / Shell Scripts Bluetooth driver Cloud Technologies Commands and Packages Compilation Content Management System Core Kernel C Programs Development, Debugging and Performance Tools Development and Build Development Environment Setup Django & REST Api Errors & Failures Git Hardware Platforms HTML JAVA Programs Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Multimedia NDK / Middleware / HAL Operating System Concepts PHP Programming Languages Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Source Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Web Design and Development Website Hosting Wordpress Yocto Embedded Linux