Skip to content

Col-E/binary-resources

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Binary Resources badge

A fork of the upstream binary-resources tool project.

What's changed?

  • No longer requires/depends-on the Android SDK artifacts
  • Helper utilities for printing binary XML
  • Obfuscation resilience, handling inputs that would otherwise crash the base project, but are valid at install-time

Usage as a library

Here's a code sample of taking the byte[] of an AndroidManifest.xml and transforming it into a formatted String.

// Create resource providers, which translate resource id values/keys into strings used in XML decoding
//  - Implementing this interface is your responsibility. 
//  - While this is a bit of work, it allows you to update what values are provided even if this project never updates.
//  - An example implementation is provided in this projects test module.
AndroidResourceProvider androidResources = ...
AndroidResourceProvider appResources = ...

// Create the binary resource (AndroidManifest.xml) reader and pass it to the XML decoder, 
//  yielding a decoded string representation of the file contents.
BinaryResourceFile binaryResource = new BinaryResourceFile(binaryXmlBytes);
String decoded = XmlDecoder.decode(binaryResource, androidResources, appResources);

The example implementation of AndroidResourceProvider can be found here:

You can use the project as a maven artifact via JitPack