You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Execution failed for task ':app:mergeReleaseResources'. after exp build:android #25641
Describe what you expected to happen:
The build is successful when I do not change the default icon in app.json but the build fails with the following error message when I change the icon. I have checked the icon, it is definitely a png file.
> Task :app:mergeReleaseResources FAILED
17 actionable tasks: 17 executed
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:mergeReleaseResources'.
[stderr] > java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
[stderr] /app/turtle/workingdir/android/sdk33/android-shell-app/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: error: failed to read PNG signature: file does not start with PNG signature.
For feature googlers: in my case i just upgraded to RN 0.60, which places an empty ic_launcher_round.png file in my app/src/main/res/mipmax-xxx folders. Place a real png file there and the error should be gone!
For feature googlers: in my case i just upgraded to RN 0.60, which places an empty ic_launcher_round.png file in my app/src/main/res/mipmax-xxx folders. Place a real png file there and the error should be gone!
Happened to me and I'm us RN 0.60.4, any better answers?
@muganwas Hi~~
Maybe try this I used to debug release build in old version, but still looks work for me now(I'm trying to update to 0.61.5).
I can't found the source where I found it, just copy from my old code and add in similar way.
My version now: RN 0.61.5
Change or add some code from here:
\node_modules\react-native\react.gradle
if(enableHermes){doLast{defhermesFlags;defhbcTempFile=file("${jsBundleFile}.hbc")exec{if(targetName.toLowerCase().contains("release")){// Can't use ?: since that will also substitute valid empty listshermesFlags=config.hermesFlagsReleaseif(hermesFlags==null)hermesFlags=["-O","-output-source-map"]}else{hermesFlags=config.hermesFlagsDebugif(hermesFlags==null)hermesFlags=[]}if(Os.isFamily(Os.FAMILY_WINDOWS)){commandLine("cmd","/c",getHermesCommand(),"-emit-binary","-out",hbcTempFile,jsBundleFile,*hermesFlags)}else{commandLine(getHermesCommand(),"-emit-binary","-out",hbcTempFile,jsBundleFile,*hermesFlags)}}ant.move(file: hbcTempFile,toFile: jsBundleFile);if(hermesFlags.contains("-output-source-map")){ant.move(// Hermes will generate a source map with this exact namefile: "${jsBundleFile}.hbc.map",tofile: jsCompilerSourceMapFile);exec{// TODO: set task dependencies for caching// Set up the call to the compose-source-maps scriptworkingDir(reactRoot)if(Os.isFamily(Os.FAMILY_WINDOWS)){commandLine("cmd","/c",*nodeExecutableAndArgs,composeSourceMapsPath,jsPackagerSourceMapFile,jsCompilerSourceMapFile,"-o",jsOutputSourceMapFile)}else{commandLine(*nodeExecutableAndArgs,composeSourceMapsPath,jsPackagerSourceMapFile,jsCompilerSourceMapFile,"-o",jsOutputSourceMapFile)}}}}//////////////////////////////////// From Here and in else put again with dolast//////////////////////////////////// If your version doesn't have code above, just add code doLast//////////////////////////////////// in else, put doLast after do firstdefmoveFunc={resSuffix->FileoriginalDir=file("${resourcesDir}/drawable-${resSuffix}");// File originalDir = file("$buildDir/generated/res/react/release/drawable-${resSuffix}");if(originalDir.exists()){FiledestDir=file("$buildDir/../src/main/res/drawable-${resSuffix}");ant.move(file: originalDir,tofile: destDir);}}moveFunc.curry("ldpi").call()moveFunc.curry("mdpi").call()moveFunc.curry("hdpi").call()moveFunc.curry("xhdpi").call()moveFunc.curry("xxhdpi").call()moveFunc.curry("xxxhdpi").call()}else{doLast{defmoveFunc={resSuffix->File originalDir =file("${resourcesDir}/drawable-${resSuffix}");// File originalDir = file("$buildDir/generated/res/react/release/drawable-${resSuffix}");if(originalDir.exists()){FiledestDir=file("$buildDir/../src/main/res/drawable-${resSuffix}");ant.move(file: originalDir,tofile: destDir);}}moveFunc.curry("ldpi").call()moveFunc.curry("mdpi").call()moveFunc.curry("hdpi").call()moveFunc.curry("xhdpi").call()moveFunc.curry("xxhdpi").call()moveFunc.curry("xxxhdpi").call()}}
Activity
RobinCsl commentedon Jul 14, 2019
Hi @GunaShekar02,
It looks like you're using Expo to build your application, so I am not sure this is the best repository to get help.
It looks like this error message was already reported on Expo's forum and the OP seems to have solved their issue: https://forums.expo.io/t/failed-to-read-png-signature-file-does-not-start-with-png-signature/23806
Hope that helps!
digistaal commentedon Sep 26, 2019
For feature googlers: in my case i just upgraded to RN 0.60, which places an empty ic_launcher_round.png file in my app/src/main/res/mipmax-xxx folders. Place a real png file there and the error should be gone!
muganwas commentedon Mar 11, 2020
Happened to me and I'm us RN 0.60.4, any better answers?
GunaShekar02 commentedon Mar 11, 2020
Using "expo-cli build:android -t apk" instead of "exp build:android" worked for me at that point.
KaoPengHsiang commentedon Mar 17, 2020
@muganwas Hi~~
Maybe try this I used to debug release build in old version, but still looks work for me now(I'm trying to update to 0.61.5).
I can't found the source where I found it, just copy from my old code and add in similar way.
My version now: RN 0.61.5
Change or add some code from here:
\node_modules\react-native\react.gradle
Hope this can help someone : )
Ankit2388 commentedon Jul 23, 2020
this is work for me
thank @KaoPengHsiang