JEWEL
(Extension Developer 🧩)
October 14, 2026, 6:18am
1
Hi Kodular Team,
I’ve run into a build issue where compiling an extension containing an AAR with font resources fails during the resource merging phase.
The Error
When building, the build server throws the following error:
[MergeResources] Starting Task
[MergeResources] ERROR: Could not merge resources
[MergeResources] Task errored in 0.014 seconds
Context & The Solution
This happens because the resource merger encounters font files inside AAR dependencies and fails to handle them properly.
A similar issue previously affected MIT App Inventor. I opened a pull request that successfully resolved this problem on the App Inventor side.
master ← jewelshkjony:fix/aar-font-resource-merge
opened 05:20AM - 06 Jun 26 UTC
**What does this PR accomplish?**
When an AAR library contains font resources u… nder `res/font/` (e.g. `res/font/myfont.ttf`), the build fails with:
````
[Fatal Error] :1:1: Content is not allowed in prolog.
[MergeResources] ERROR: Could not merge resources
````
This happens because the `ResourceMerger` attempts to parse binary `.ttf`/`.otf` files as XML, causing a `MergingException`.
This PR fixes the issue by introducing `moveFontsToOutputDir()` in [AARLibraries.java](https://github.com/jewelshkjony/appinventor-sources/blob/923365e5b2079560a256070bc771ec3309611ba7/appinventor/buildserver/src/com/google/appinventor/buildserver/util/AARLibraries.java#L219), which walks the AAR's `res/font/` directory using `Files.walkFileTree()` and moves all font files (including subdirectories) directly into the merged resource output directory before `ResourceMerger` runs.
This ensures:
- `ResourceMerger` never encounters font files.
- `aapt` picks up the fonts from the merged output and packages them into the APK/AAB correctly.
- Resource IDs (e.g. `R.font.myfont`) are correctly assigned and linked in `R.class`.
*Testing Guidelines*
1. Add an AAR that contains font (`res/font/myfont.ttf`) as a dependency to an App Inventor extension or component.
2. Build the application as APK/AAB.
3. Verify the build completes without `MergingException`.
4. Decompile the resulting APK and confirm:
- `res/font/` contains the expected font files.
- The expected package's `R.class` contains a `font` inner class with correct
`aapt`-assigned resource IDs (e.g. `0x7f04xxxx`).
5. Run the app and verify font resources load correctly at runtime without
`Resources.NotFoundException`.
Testing Results #.
1. Font files are packaged correctly:
<img width="457" height="274" alt="image" src="https://github.com/user-attachments/assets/6e6b1335-6352-47e9-bdfa-dba1406524bb" />
<img width="456" height="275" alt="image" src="https://github.com/user-attachments/assets/4aaadbef-e174-4134-be88-63fecc30ef51" />
2. IDs linked correctly to R.class
<img width="966" height="193" alt="image" src="https://github.com/user-attachments/assets/1557ea5f-cc59-47b0-9819-cf6ead15d9fa" />
<img width="971" height="164" alt="image" src="https://github.com/user-attachments/assets/e2b64e67-c25b-49ed-9608-efd0f1d90242" />
Fixes # .
#3610
Resolves # .
**Context for the changes**
If this PR changes anything related to the companion make sure you have used the `ucr` branch. For all other changes use `master` or provide context for having used a different branch.
See a summary of git branches in the docs: [App Inventor Developer Overview](https://docs.google.com/document/u/1/d/1hIvAtbNx-eiIJcTA2LLPQOawctiGIpnnt0AvfgnKBok/pub#h.g4ai8y7wpbh6)
If your code changes how something works on the device (i.e., it affects the companion):
- [x] I have made no changes that affect the companion
- [ ] I branched from `ucr`
- [ ] My pull request has `ucr` as the base
Further, if you've changed the blocks language or another user-facing designer/blocks API (added a SimpleProperty, etc.):
- [ ] I have updated the corresponding version number in appinventor/components/src/.../common/YaVersion.java
- [ ] I have updated the corresponding upgrader in appinventor/appengine/src/.../client/youngandroid/YoungAndroidFormUpgrader.java (components only)
- [ ] I have updated the corresponding entries in appinventor/blocklyeditor/src/versioning.js
For all other changes:
- [ ] I have made no changes that affect the master branch
- [x] I branched from `master`
- [x] My pull request has `master` as the base
**General items:**
- [ ] I have updated the relevant documentation files under docs/
- [x] My code follows the:
- [x] [Google Java style guide](https://google.github.io/styleguide/javaguide.html) (for .java files)
- [ ] [Google JavaScript style guide](https://google.github.io/styleguide/jsguide.html) (for .js files)
- [ ] [Swift style guide](https://google.github.io/swift/) (for .swift files)
- [x] Indentation has been doubled checked
- [x] This PR does not include unnecessary changes such as formatting or white space
- [x] `ant tests` passes on my machine
Applying the same fix to support font resources in AARs would resolve this issue and allow developers to use custom fonts bundled within third-party libraries/AARs without breaking builds.
@Diego Could you please take a look at incorporating this fix into the next Kodular update?
Thank you for your time and continued work on Kodular!