Skip to content

Bug and possible fix for parsing APK files manifest data #18

@AndroidDeveloperLB

Description

@AndroidDeveloperLB

Example is of Chrome and Chrome beta:

chrome and chrome beta.zip

The issue with those seems that it causes attributes to have namespace missing, as such:

<?xml version="1.0" encoding="utf-8"?>
<manifest http://schemas.android.com/apk/res/android:versionCode="398706833" http://schemas.android.com/apk/res/android:versionName="80.0.3987.68" http://schemas.android.com/apk/res/android:compileSdkVersion="29" http://schemas.android.com/apk/res/android:compileSdkVersionCodename="10" package="com.chrome.beta" platformBuildVersionCode="29" platformBuildVersionName="10">
...

Here's the full output of parsing Chrome beta using ApkParser.create(file).manifestXml :

chromeBetaManifestContent.zip

This is considered as invalid XML.

However, I've found a way to parse their manifest anyway. And it seems to fix this issue too .

I made a test, and it seems that I got it right for manifest files of both normal APK files and split APK files. This code is based on this solution on StackOverflow :

ApkManifestFetcher.zip

Please check it out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions