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:
- Download apktool-install-windows-* file
- Download apktool-* file
- 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:
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
Arrayadapter in Android to Create Simple Listview
Android Device Not Shown with Adb
Open an Image Using Uri in Android's Default Gallery Image Viewer
Blue Dot and Circle Is Not Shown on Mylocation Using Android Fused Location API
How to Keep/Exclude a Particular Package Path When Using Proguard
Selecting Multiple Items in Listview
Listview Subobject Clickable Confilct
How to Strike Through Text in an App Widget
Voice Recognition on Android with Recorded Sound Clip
How to Add a Badge to an Application Icon in Android
System Is Returning Error 127 When Called from C++ in Linux
Do I Need All Three Constructors for an Android Custom View
Out of Memory Error with Bitmap
How to Prevent a Service from Being Killed by Os
Android: How to Make a Clickable Map Image with Each Country Producing a Different Action