mergeReleaseResources FAILED, failed to read PNG signature

On SAB 6.2, Win10, I’ve got a failure error for mergeReleaseResources, saying it failed to read the PNG signature for my icons.
I’ve tried both the standard icons from the SAB gallery and also tried to make customized icons using the link in SAB to open Android Asset Studio in Chrome to upload an image, then download a zip with PNG icon files sized for mdpi, hdpi, xhdpi, xxhdpi and xxxhdpi. But both standard and customized icons I get error messages about these files. I’ll include the text of my build error, and a screen capture here of the relevant part:

Is the problem that I’ve used unicode in the App Project Name? Bɩgabaazɩya I see that below it created ? in the place of the unicode characters.
I don’t think it’s an internet problem, I’m getting about 20Mbps with fiber optic cable at my home.

Here is the text from my command prompt dialogue on building the app:

C:\Users\andyw\AppData\Local\Temp\App Builder\build\SAB.001\a>set ERROR_CODE=0

*** SCRIPTURE APP BUILDER ***
*** 6.2 ***

*** Building Android app ***

App Project: B?gabaaz?ya
App Name: B?gabaaz?ya
App Version: 0.0.1
Package: net.tembiya.test.gen.kdh
Apk Filename: net.tembiya.test.gen.kdh-0.0.1.apk

Grandroid: No
Analytics: Yes
Expiry: 2020-04-01
App Builder: C:\Program Files (x86)\SIL\Scripture App Builder
Audio: None

*** Setting paths ***

JAVA_HOME=C:\Program Files\Amazon Corretto\jdk1.8.0_242
ANDROID_HOME=D:\ProgramFiles\Android\sdk
GRADLE_HOME=C:\Program Files (x86)\SIL\Scripture App Builder\tools\gradle
MAVEN_HOME=C:\Program Files (x86)\SIL\Scripture App Builder\tools\maven

Path=C:\Program Files (x86)\SIL\Scripture App Builder\tools\maven\bin;C:\Program Files (x86)\SIL\Scripture App Builder\tools\gradle\bin;D:\ProgramFiles\Android\sdk\tools;C:\Program Files\Amazon Corretto\jdk1.8.0_242\bin;C:\Program Files\Amazon Corretto\jdk1.8.0_242\bin;C:\Python27;C:\Python27\Scripts;C:\Program Files (x86)\Common Files\SIL;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\Intel® Management Engine Components\DAL;C:\Program Files\Intel\Intel® Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel® Management Engine Components\IPT;C:\Program Files\Intel\Intel® Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;D:\X Program Files\QTSystem;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\FFmpeg\bin;C:\Program Files (x86)\eSpeak\command_line;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files (x86)\Common Files\Adobe\AGL;C:\Users\andyw\AppData\Local\Microsoft\WindowsApps;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

*** JDK ***

openjdk version “1.8.0_242”
OpenJDK Runtime Environment Corretto-8.242.08.1 (build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM Corretto-8.242.08.1 (build 25.242-b08, mixed mode)

*** Android SDK ***

Target Android Platform: Android 9.0 Pie (API 28)
Minimum Android Platform: Android 4.0-4.0.2 Ice Cream Sandwich (API 14)
SDK Tools Version: 25.2.5
SDK Build Tools Version: 28.0.3
SDK Platform Tools Version: 29.0.6

*** Compiling apk ***

C:\Users\andyw\AppData\Local\Temp\App Builder\build\SAB.001\a>call gradle clean assembleRelease

Task :mergeReleaseResources FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:mergeReleaseResources’.

5 exceptions were raised by workers:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
C:\Users\andyw\AppData\Local\Temp\App Builder\build\SAB.001\a\res\drawable-xhdpi\title_page.png: error: failed to read PNG signature: file does not start with PNG signature.
C:\Users\andyw\AppData\Local\Temp\App Builder\build\SAB.001\a\res\drawable-xhdpi\title_page.png: error: file failed to compile.

com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
C:\Users\andyw\AppData\Local\Temp\App Builder\build\SAB.001\a\res\drawable-xxhdpi\nav_drawer.png: error: failed to read PNG signature: file does not start with PNG signature.
C:\Users\andyw\AppData\Local\Temp\App Builder\build\SAB.001\a\res\drawable-xxhdpi\nav_drawer.png: error: file failed to compile.

com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
C:\Users\andyw\AppData\Local\Temp\App Builder\build\SAB.001\a\res\drawable-mdpi\title_page.png: error: failed to read PNG signature: file does not start with PNG signature.
C:\Users\andyw\AppData\Local\Temp\App Builder\build\SAB.001\a\res\drawable-mdpi\title_page.png: error: file failed to compile.

com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
C:\Users\andyw\AppData\Local\Temp\App Builder\build\SAB.001\a\res\drawable-xxxhdpi\nav_drawer.png: error: failed to read PNG signature: file does not start with PNG signature.
C:\Users\andyw\AppData\Local\Temp\App Builder\build\SAB.001\a\res\drawable-xxxhdpi\nav_drawer.png: error: file failed to compile.

com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
C:\Users\andyw\AppData\Local\Temp\App Builder\build\SAB.001\a\res\drawable-hdpi\nav_drawer.png: error: failed to read PNG signature: file does not start with PNG signature.
C:\Users\andyw\AppData\Local\Temp\App Builder\build\SAB.001\a\res\drawable-hdpi\nav_drawer.png: error: file failed to compile.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 6s
10 actionable tasks: 9 executed, 1 up-to-date
The system cannot find the path specified.

BUILD FAILED:
The signed apk was not built successfully. This could be due to an internet connection problem. On the first build, the compiler needs to connect to the internet to download some library files.

C:\Users\andyw\AppData\Local\Temp\App Builder\build\SAB.001\a>

I tried building again with the name changed to Bigabaaziya and I got the same error, so it apparently is not the issue.

Is the problem maybe my edition of the SDK
SDK Tools Version: 25.2.5
SDK Build Tools Version: 28.0.3
SDK Platform Tools Version: 29.0.6
Other details are in the text from my CMD.

At first I suspected the PNG files, but they are images and do open up in image viewers. I’ve also opened up the PNG files to view their text and they all start like any other PNG file:

It seems that SAB wants me to use no special characters in the project name. Using Aeneas is also not working for a project I called: Tem Filíipu you’ll see in the text below it converted that to Tem Fili?ipu in the file path, see bold below. Note, when I removed the accent in the project name then it worked (because the accent in the folder name was also removed).

“task_language=eo|is_text_type=parsed|os_task_file_format=tsv|os_task_file_head_tail_format=hidden|is_audio_file_detect_head_min=5.00|is_audio_file_detect_head_max=10.00|task_adjust_boundary_algorithm=percent|task_adjust_boundary_percent_value=50” “D:\andyw\Documents\App Builder\Scripture Apps\App Projects\Tem Fili?ipu\Tem Fili?ipu_data\timings\C01-01-PHP-01-timing.txt” --skip-validator
[ERRO] Unable to create file 'D:\andyw\Documents\App Builder\Scripture Apps\App Projects\Tem Fili?ipu\Tem Fili?ipu_data\timings\C01-01-PHP-01-timing.txt’
[ERRO] Make sure the file path is written/escaped correctly and that you have write permission on it

Have you tried looking following those file paths to see what is in those particular images folders? I would maybe start with some investigation there.

I’ve had various problems in the past with similar error messages. One thing that has happened to me more than once is that one or more of these image file paths were simply too long and the app couldn’t be compiled because of it. Can’t remember what the character limit is, but there is a limit. Yours don’t look horribly long, but you could try shortening the image file name as a test. There’s probably not much else that you could shorten.

I think once before, I accidentally saved my splash screen (title_page.png) as a JPG but had it titled as a PNG. That obviously caused an error for me.

Have you successfully built other SAB projects containing title_page (splash screen) and nav_drawer images?

I opened the file paths, and found files there labeled there as .PNG files. But when I opened the files in a TXT viewer, they were in fact *.jpg files. It turns out that inside SAB I had uploaded my original files as JPG, and SAB simply stripped the .jpg and replaced it with .png. So they were JPG with *.PNG extensions.
I replaced the files with real PNG and not it works. It would be nice if SAB accepted JPG, because the files are about half the size. Or at a minimum SAB should tell me that my files were JPG and must be PNG to build the app.

Yes I was able to build other SAB projects, but only without the title_page and nav_drawer images. So when I noticed that difference I replaced the JPG.PNG with PNG.PNG files and now they work.

Oh yeah, that is exactly what happened to me before. I’m glad to hear that your issue is solved! :+1:

1 Like

Great work @NeilZubot

@Andy_Weathers If you use the Add Image button it only shows you PNG or ZIP files. But it does allow you to drag a JPG file into the Navigation Draw, and renames it as a PNG.

I’ll write this up as a bug.