React Native/React Native_error

[React Native] 파일 확장자 에러 : failed to read PNG signature: file does not start with PNG signature

bocoder
728x90
반응형

App 개발 시 기본으로 설정되어있던 android launcher image 를 변경하였고, 

debug 모드로 빌드(cmd : react-native run-android) 했을 시 정상적으로 되었지만,

release apk 를 빌드(cmd: react-native run-android --variant=release) 하니 다음과 같은 오류가 발생함.

 

> Task :app:mergeReleaseResources FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
102 actionable tasks: 8 executed, 94 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
> Multiple task action failures occurred:
   > A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
      > Android resource compilation failed
        ERROR:/Users/.../android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.
            
        ERROR:/Users/.../android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: AAPT: error: file failed to compile.

# 결론: 이미지 형식이 .png 가 아닌데 확장자 이름이 .png 로 되어있는 경우 생기는 오류

 

# 원인

기존 .jpg 로  되어있던 icon 파일을, 아래 사이트 사이즈를 변경하였음

사이즈 변경 시 확장자도 .png 로 변경되었고 그대로 사용함

 

     * app icon image (1024x1024) to generate different app icon sizes for all platforms

     https://appicon.co/

     * for android round image 

     http://asq.kr/ZEZEcS 

 

# 해결방법

기존 .jpg 로 되어있던 icon 파일을, 먼저 아래 사이트에서 .png 로 변경한 후,

위의 사이트에서 동일한 방식으로 사이즈를 변경하니 잘 빌드됨

 

     * jpg -> png 파일 확장자 변경

     https://jpg2png.com/ko/

 

     * 파일 크기 변경

     https://www.resizepixel.com/ko

728x90
반응형