user1147768
user1147768

Reputation:

How to read compiled XML files such as the Android manifest

Could anyone tell me how to read the content of a compiled xml file, i.e. after extracting it from .apk file.

The xml file is from other application.

Upvotes: 3

Views: 5672

Answers (4)

Tamilan C.Periyasamy
Tamilan C.Periyasamy

Reputation: 343

    Use appt for android-sdk (ex:- /build-tools/27.0.3/aapt )

    ./aapt d xmltree ./debug.apk  AndroidManifest.xml

    N: android=http://schemas.android.com/apk/res/android
      E: manifest (line=1)
        A: android:versionCode(0x0101021b)=(type 0x10)0x1
        A: android:versionName(0x0101021c)="1.0" (Raw: "1.0")
        A: package="com.example.activity" (Raw: "com.example.activity")
        E: uses-sdk (line=6)
          A: android:minSdkVersion(0x0101020c)=(type 0x10)0x8
          A: android:targetSdkVersion(0x01010270)=(type 0x10)0xf
        E: application (line=8)
          A: android:label(0x01010001)=@0x7f030000
          A: android:icon(0x01010002)=@0x7f020000
          E: activity (line=10)
            A: android:label(0x01010001)=@0x7f030000
            A: android:name(0x01010003)=".SampleActivity" (Raw: ".SampleActivity")
            E: intent-filter (line=12)
              E: action (line=13)
                A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
              E: category (line=14)
                A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")

This link might help http://elinux.org/Android_aapt

Another one tool for "AXMLPrinter" google source link https://code.google.com/archive/p/android4me/downloads

java -jar ./AXMLPrinter2.jar ./debug.apk_FILES/AndroidManifest.xml

Upvotes: 0

user1139880
user1139880

Reputation: 1838

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.

Upvotes: 3

Shachar Shemesh
Shachar Shemesh

Reputation: 8583

You can use apktool, but if you just want to view the content, there is a faster way. Just run "aapt dump xmltree apkfile path". aapt is available from the Android SDK. path is the relative path inside the APK of the XML file. You can view all files in the APK using unzip, or by running "aapt l apkfile".

The format of the result is not XML, but should give you the structure of the original XML. E: means element, A: means attribute, C: means content etc.

Shachar

Edited to add: You can also see the nesting of the elements through the indenting aapt does.

Upvotes: 1

Stephan Celis
Stephan Celis

Reputation: 2612

As far as I know it's not possible unless you have the 'key' used when the application was compiled/encrypted.

To protect to source code.

Upvotes: -3

Related Questions