aXML is a pure Java library for decoding and encoding Android binary XML (aXML) files.
Originally developed for APK Explorer & Editor, aXML is now a standalone, open-source project β available through JitPack for developers who want to work directly with Android binary XML formats.
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}dependencies {
implementation 'com.github.apk-editor:aXML:Tag'
}π Note: Replace
Tagwith the latest commit ID.
The aXMLDecoder provides functionality to decode Android binary XML (aXML) into:
- A list of serializable
XMLEntryobjects, or - A human-readable XML string
List<XMLEntry> manifestEntries;
try {
manifestEntries = new aXMLDecoder(xmlStream, resourceEntries).decode();
} catch (XmlPullParserException e) {
// Handle exception
}Parameters:
xmlStreamβ InputStream of the binary aXML fileresourceEntriesβ List ofResEntryparsed fromresources.arsc
String decodedString;
try {
decodedString = new aXMLDecoder(xmlStream, resourceEntries).decodeAsString();
} catch (XmlPullParserException e) {
// Handle exception
}List<XMLEntry> manifestEntries = new aXMLDecoder(xmlStream).decode();
String decodedString = new aXMLDecoder(xmlStream).decodeAsString();The aXMLEncoder provides functionality to encode readable XML into Androidβs binary aXML format.
public static boolean isXMLValid(String xmlString) {
try {
SAXParserFactory.newInstance()
.newSAXParser()
.getXMLReader()
.parse(new InputSource(new StringReader(xmlString)));
return true;
} catch (ParserConfigurationException | SAXException | IOException e) {
return false;
}
}try (FileOutputStream fos = new FileOutputStream(pathToaXMLFile)) {
aXMLEncoder encoder = new aXMLEncoder();
byte[] data = encoder.encodeString(activity, xmlString);
fos.write(data);
} catch (IOException | XmlPullParserException e) {
// Handle exception
}The ResourceTableParser parses Android resource tables (resources.arsc) into serializable ResEntry objects.
List<ResEntry> resourceEntries;
try {
resourceEntries = new ResourceTableParser(resStream).parse();
} catch (IOException e) {
// Handle exception
}The APKParser provides a high-level interface to analyze APK files, extract metadata, and decode manifests/resources.
APKParser apkParser = new APKParser();
apkParser.parse(pathToAPK, context);
if (apkParser.isParsed()) {
Drawable appIcon = apkParser.getAppIcon();
List<ResEntry> resourceEntries = apkParser.getDecodedResources();
List<XMLEntry> manifestEntries = apkParser.getManifest();
List<String> permissions = apkParser.getPermissions();
long apkSize = apkParser.getAPKSize();
String apkCertificate = apkParser.getCertificate();
String appName = apkParser.getAppName();
String versionName = apkParser.getVersionName();
String compiledSDKVersion = apkParser.getCompiledSDKVersion();
String decodedManifest = apkParser.getManifestAsString();
String packageName = apkParser.getPackageName();
String targetSDKVersion = apkParser.getTargetSDKVersion();
String versionCode = apkParser.getVersionCode();
}Copyright (C) 2023-2025 APK Explorer & Editor <[email protected]>
aXML is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
aXML is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
We welcome community contributions!
To contribute:
- Fork this repository
- Create a feature branch (
feature/your-feature) - Commit and push your changes
- Open a Pull Request π
π‘ Thank you for supporting open-source Android development with aXML!
