I am in the process of making an app which encodes an AndroidManifest.xml to binary, and packages files into an APK, testing using apktool, everything worked however, after I wrote my app and tried to encode the manifest using aXML, no errors were given, and everything worked up until it had to install, then the package manager complained that module was an invalid tag under manifest, this is not the case, I am using dist:module provided via xmlns:dist="http://schemas.android.com/apk/distribution". It seems that for some reason aXML is not preserving this namespace.
Below is the code that I used when encoding the manifest.
val manifest = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<manifest android:versionCode=\"$versionCode\" android:isFeatureSplit=\"true\" android:compileSdkVersion=\"34\" android:compileSdkVersionCodename=\"14\" package=\"com.example.example\" platformBuildVersionCode=\"34\" platformBuildVersionName=\"14\" split=\"test_documents_provider\"\n" +
"xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" +
"xmlns:dist=\"http://schemas.android.com/apk/distribution\">\n" +
"\t<dist:module dist:type=\"feature\">\n" +
"\t\t<dist:fusing dist:include=\"true\" />\n" +
"\t\t<dist:delivery>\n" +
"\t\t\t<dist:install-time />\n" +
"\t\t</dist:delivery>\n" +
"\t</dist:module>\n" +
"\t<application android:hasCode=\"true\">\n" +
"\t\t<provider android:authorities=\"com.example.documents\" android:enabled=\"true\" android:exported=\"true\" android:grantUriPermissions=\"true\" android:name=\"com.example.example.Provider\" android:permission=\"android.permission.MANAGE_DOCUMENTS\">\n" +
"\t\t\t<intent-filter>\n" +
"\t\t\t\t<action android:name=\"android.content.action.DOCUMENTS_PROVIDER\"/>\n" +
"\t\t\t</intent-filter>\n" +
"\t\t</provider>\n" +
"\t</application>\n" +
"</manifest>\n"
val manifestBytes = aXMLEncoder().encodeString(this, manifest.trim())
In the code above versionCode is fetched by the app using PackageManager to get the info, and retrieve the version code, since the patch will work on all versions of an app. For now just a test app is used.
I am in the process of making an app which encodes an AndroidManifest.xml to binary, and packages files into an APK, testing using apktool, everything worked however, after I wrote my app and tried to encode the manifest using aXML, no errors were given, and everything worked up until it had to install, then the package manager complained that
modulewas an invalid tag undermanifest, this is not the case, I am usingdist:moduleprovided viaxmlns:dist="http://schemas.android.com/apk/distribution". It seems that for some reason aXML is not preserving this namespace.Below is the code that I used when encoding the manifest.
In the code above
versionCodeis fetched by the app usingPackageManagerto get the info, and retrieve the version code, since the patch will work on all versions of an app. For now just a test app is used.