DEV Community

Arthur031221
Arthur031221

Posted on

Checking a React Native bundle entry inside an APK or AAB

I built rn-artifact-check to answer a small release question from the archive itself: does the APK or AAB contain the bundle entry I expect, and do the bytes match its ZIP directory metadata?

Terminal demo of rn-artifact-check inspecting synthetic packaging fixtures

What I check

I use the standard entry path for each archive type by default. For an APK, I look for assets/index.android.bundle. For an AAB, I look for base/assets/index.android.bundle. I also accept an exact custom path when a project packages the bundle elsewhere.

I scan the central directory to find duplicate selected paths and require one nonempty Android manifest marker. I do not parse that marker. After finding one bundle entry, I stream it and compare the decompressed byte count and CRC with the entry metadata. I cap the number of entries, aggregate central directory metadata, and compressed and expanded bundle bytes.

What a pass means

I keep the result deliberately limited. I define a pass as a selected entry that is present, nonempty, and consistent with its declared size and CRC. I do not validate the APK signature, prove Android can load the bundle, inspect JavaScript semantics, validate Hermes bytecode, or check every other archive entry.

I leave Android App Bundle tooling to bundletool. I use Expo Doctor as a project configuration and dependency check, and rn-bundle-swapper to replace package contents and sign output. I only inspect the existing Android archive.

Trying it

I use Node.js 20 or newer. I can run the packaged fixture demo with:

npx --yes --package=github:Arthur031221/rn-artifact-check rn-artifact-check --demo
Enter fullscreen mode Exit fullscreen mode

I expect the demo to show a missing APK bundle path followed by an AAB bundle pass. The archives are small synthetic packaging fixtures. I do not present them as installable Android builds. I test stored and deflated entries, failures, archive limits, JSON output, and artifact immutability with Node's test runner.

I wrote the CLI for teams that want this one archive check in a release step. I publish the source under MIT and welcome focused bug reports with the command and observed result.

Project: https://github.com/Arthur031221/rn-artifact-check

Top comments (0)