Fix invalid entries within a manifest file of a BAR file

Occasionally, the apk2bar tool fails to repackage an APK because it mapped one or more invalid attributes to the BAR manifest file.

Typically, the problem is the result of attribute values that are too long. For example, the BlackBerry 10 OS only accepts BAR package names that are 29 characters or fewer. If the Package-Name attribute mapped from the AndroidManifest.xml file exceeds the maximum length, the repackaging fails. When the repackaging of an app fails as a result of invalid attributes in the manifest file, the apk2bar tool generates a manifest file for that app, with the name <APK_filename>.mf, and saves it in the same folder as the APK file. The tool displays an error message that indicates which attribute caused the repackaging to fail.

To correct this issue, modify the generated manifest file for the app and package this custom manifest file with the BAR file.

  1. Using an archiving tool, locate and open <APK_filename>.bar that apk2bar tool generated.
  2. Extract the meta-inf/manifest.mf file to the folder that contains your APK files.
  3. Rename the file as <APK_filename>.mf.
  4. Iin any text editor that preserves UNIX line terminators, open the <APK_filename>.mf file.
  5. Modify the problematic attribute value(s) as necessary. Note that manifest file attributes are subject to restrictive syntax and length constraints.
  6. Save the file.
After you finish: After you modify and save the file, you'll need to run the apk2bar tool, passing the -m argument. The apk2bar tool should be properly mapped to an APK file in order to add the manifest file to the BAR file. This prevents generating a manifest from the AndroidManifest.xml file.
comments powered by Disqus