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 demonstrated 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