Gradle build failing with this error:
Error:C:UsersRoman.gradlecachestransforms-1files-1.1appcompat-v7-26.0.2.aarbab547c3f1b8061ef9426f524a823a15resdrawable-xhdpi-v4abc_btn_switch_to_on_mtrl_00001.9.png failed to read PNG signature: file does not start with PNG signature
Error:java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed:
Error:Execution failed for task ':app:mergeDebugResources'.
Error: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed:
aapt2 compile --legacy -o C:devworkspaceandroid2MatrixCalculatorappbuildintermediatesresmergeddebug C:UsersRoman.gradlecachestransforms-1files-1.1appcompat-v7-26.0.2.aarbab547c3f1b8061ef9426f524a823a15resdrawable-xhdpi-v4abc_btn_switch_to_on_mtrl_00001.9.png
Issues:
- ERROR: C:UsersRoman.gradlecachestransforms-1files-1.1appcompat-v7-26.0.2.aarbab547c3f1b8061ef9426f524a823a15resdrawable-xhdpi-v4abc_btn_switch_to_on_mtrl_00001.9.png failed to read PNG signature: file does not start with PNG signature
Some basic things i’ve tried to solve this issue:
- Invalidate caches/restart
- Deleting gradle folder
asked Sep 12, 2017 at 13:19
10
It’s likely a JPG
renamed to a PNG
file, not an actual PNG file
The problem could be because of the wrong extension of images.
In my case, the file was a JPEG
image but it was saved as PNG
not converted to. In this situation change extension to the real one and convert to PNG then retry.
For instance, you have ic_logo.png
but it’s actually a JPG image.
You should rename it back to ic_logo.jpg
and use something like Photoshop to convert the image to PNG format.
answered Feb 2, 2018 at 20:30
Mahdi-MalvMahdi-Malv
14.9k10 gold badges67 silver badges107 bronze badges
4
android {
buildTypes {
release {
crunchPngs false // or true
}
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
crunchPngs false // or true
lintOptions {
checkReleaseBuilds false
abortOnError false
}
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
answered Jan 28, 2020 at 9:17
Keshav GeraKeshav Gera
10.6k1 gold badge74 silver badges52 bronze badges
1
Steps
- In
build.gradle
aaptOptions {
cruncherEnabled = false
}
- Delete content inside
C:Users.gradlecaches
(or~/.gradle/caches
for Mac and Linux) - Restart Android Studio
Mahdi-Malv
14.9k10 gold badges67 silver badges107 bronze badges
answered Nov 12, 2017 at 22:22
Diego VenâncioDiego Venâncio
5,4392 gold badges47 silver badges67 bronze badges
3
Failed to read PNG signature — Just put 1 line in your build.gradle
buildTypes {
release {
minifyEnabled true
shrinkResources true
crunchPngs false // Paste this line
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
answered Mar 3, 2022 at 4:54
Kumar SantanuKumar Santanu
5741 gold badge7 silver badges13 bronze badges
Creating the .apk of an application all the resources are analyzed, if some resource has an incorrect format or is corrup you will get the message:
.png failed to read PNG signature: file does not start with PNG
signature
Be sure to have the correct resources, you can check it by opening your file.
answered Dec 29, 2017 at 17:47
JorgesysJorgesys
123k23 gold badges328 silver badges264 bronze badges
This occurs due to the incorrect extension given to the image. For example, the image is jpg and the extension given is png.
Solutions:
- Add
{ cruncherEnabled = false }
in build.gradle - Convert the image into png rather than just changing the extension.
answered Apr 12, 2020 at 11:58
Saqib NaseebSaqib Naseeb
7111 gold badge9 silver badges21 bronze badges
I had the same issue, solved by converting the images to webP from Android studio
right-click on the image -> tap on Convert to WebP
the conversion will handle file formating and also reduce the size of the PNG
answered Dec 7, 2020 at 11:07
BennyPBennyP
1,6671 gold badge16 silver badges24 bronze badges
This is a result of wrong file type indeed and can be fixed by saving the files in correct format.
I ran into this issue with PhoneGap Build and wanted to leave my 2 cents for any other PhoneGap / Cordova user who might also run into this.
My problem was that I upgraded my old PhoneGap 6.x to 8.0 and it seems behaviour of the default splash has changed. It used to require jpg as a default splash, but on 8.0 it results in this error on production builds.
This worked before:
<splash src="www/splash.jpg" />
Now you have 2 options. Replace the default splash with png like this:
<splash src="www/res/screen/android/screen-xhdpi-portrait.png" />
Other option is to remove default splash entirely.
answered Feb 7, 2018 at 13:41
FirzeFirze
3,7916 gold badges48 silver badges61 bronze badges
For a quick fix ,Make shrinkResources to false instead of true in app.gradle
Hope this will help.
if Not then also add this aaptOptions { cruncherEnabled = false }
answered Mar 20, 2018 at 5:17
Prinkal KumarPrinkal Kumar
3,1462 gold badges10 silver badges15 bronze badges
i have same error for slow i do some step:
- open abc_btn_switch_to_on_mtrl_00001.9.png (Image)file in paint
- now select png and save as and re-save in drawable and overweight in with old images and its work
answered Jun 25, 2018 at 7:20
If you don’t have any transparent pixels, then renaming the file to .jpg
worked for me.
answered Jun 25, 2018 at 16:37
Varun BarveVarun Barve
3232 gold badges8 silver badges18 bronze badges
You might have used a JPEG file or some other image file format.
Use PNG images to solve the error.
Drawable directory can only have png type of images.
answered Jan 3, 2018 at 16:11
If you are using an online platform to generate App Icon(launcher_icon), then use PNG Format or First convert JPEG to PNG and then used APP ICON GENERATOR
answered Jan 31, 2021 at 10:23
paulpaul
4596 silver badges13 bronze badges
1
In my case also there was a jpg file instead of png, so I changed my extension and solve my problem.
answered Mar 6, 2021 at 3:39
Open [Root_project]/app/build.gradle and add following lines.
release {
...
crunchPngs false // or true
lintOptions {
checkReleaseBuilds false
abortOnError false
}
...
}
answered Oct 4, 2022 at 16:46
if you are facing this issue in Flutter while buildings apk then add crunchPngs false
android {
buildTypes {
release {
...
crunchPngs false
}
}
into android/app/build.gradle
answered Nov 4, 2022 at 19:46
1
I’m not sure if it’s a valid solution, but deleting only the file mentioned in the error message helped. While deleting the folder, containing it didn’t.
answered Sep 12, 2017 at 13:39
Ooba EldaOoba Elda
1,5521 gold badge11 silver badges18 bronze badges
I’ve had the same issue. To solve it just restart your Android Studio and build the gradle file again.
Dharman♦
29.3k21 gold badges80 silver badges131 bronze badges
answered Jul 26, 2020 at 5:23
You can add code in node_modules/react-native/react.gradle. After doFirst
doLast {
def moveFunc = { resSuffix ->
File originalDir = file("$buildDir/generated/res/react/release/${resSuffix}");
if (originalDir.exists()) {
File destDir = file("$buildDir/../src/main/res/${resSuffix}");
ant.move(file: originalDir, tofile: destDir);
}
}
moveFunc.curry("drawable-ldpi").call()
moveFunc.curry("drawable-mdpi").call()
moveFunc.curry("drawable-hdpi").call()
moveFunc.curry("drawable-xhdpi").call()
moveFunc.curry("drawable-xxhdpi").call()
moveFunc.curry("drawable-xxxhdpi").call()
moveFunc.curry("raw").call()
}
check it if it not fix issue after remove drawable folder
github enter link description here
answered Mar 19, 2021 at 8:35
I was able to fix it permanently.
I created a new blank expo project, then I added a new app icon (correct png format), then I ejected from expo.
I then copied the mipmap-*
folders from the blank project to my real project. It all worked perfectly.
answered Aug 2, 2021 at 11:44
You can open the images with windows win10 ‘Paint’,
then you can save as .png and overrite it,
It will solve the problem
answered Aug 4, 2021 at 14:11
UcdemirUcdemir
2,7152 gold badges25 silver badges43 bronze badges
0
Skip to content
You need to change some configurations in android/app/build.gradle. Follow the below setups:-
Step 1.
// add or change crunchPngs to false android { buildTypes { release { crunchPngs false // or true } } }
Step 2.
// Clean Build using below command inside android folder ./gradlew clean // Next run below for the release build ./gradlew bundleRelease
typedef redefinition with different types (‘uint8_t’ (aka ‘unsigned char’) vs ‘enum clockid_t’) react native
AAPT: error: failed to read PNG signature: file does not start with PNG signature, aapt error failed to read png signature file does not start with png signature,aapt error failed to read png signature file does not start with png signature. flutter,aapt error failed to read png signature file does not start with png signature. android,aapt error failed to read png signature file does not start with png signature. react native, failed to read PNG signature: file does not start with PNG signature, Android Studio AAPT: error: failed to read PNG signature, Android Build failed to read PNG signature, mergeReleaseResources FAILED, failed to read PNG signature, error: failed to read PNG signature: file does not start with PNG signature, error: failed to read PNG signature: file does not start with PNG signature
Post Views:
869
Gradle build failing with this error:
Error:C:UsersRoman.gradlecachestransforms-1files-1.1appcompat-v7-26.0.2.aarbab547c3f1b8061ef9426f524a823a15resdrawable-xhdpi-v4abc_btn_switch_to_on_mtrl_00001.9.png failed to read PNG signature: file does not start with PNG signature
Error:java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed:
Error:Execution failed for task ':app:mergeDebugResources'.
Error: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed:
aapt2 compile --legacy -o C:devworkspaceandroid2MatrixCalculatorappbuildintermediatesresmergeddebug C:UsersRoman.gradlecachestransforms-1files-1.1appcompat-v7-26.0.2.aarbab547c3f1b8061ef9426f524a823a15resdrawable-xhdpi-v4abc_btn_switch_to_on_mtrl_00001.9.png
Issues:
- ERROR: C:UsersRoman.gradlecachestransforms-1files-1.1appcompat-v7-26.0.2.aarbab547c3f1b8061ef9426f524a823a15resdrawable-xhdpi-v4abc_btn_switch_to_on_mtrl_00001.9.png failed to read PNG signature: file does not start with PNG signature
Some basic things i’ve tried to solve this issue:
- Invalidate caches/restart
- Deleting gradle folder
It’s likely a JPG
renamed to a PNG
file, not an actual PNG file
The problem could be because of the wrong extension of images.
In my case, the file was a JPEG
image but it was saved as PNG
not converted to. In this situation change extension to the real one and convert to PNG then retry.
For instance, you have ic_logo.png
but it’s actually a JPG image.
You should rename it back to ic_logo.jpg
and use something like Photoshop to convert the image to PNG format.
android {
buildTypes {
release {
crunchPngs false // or true
}
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
crunchPngs false // or true
lintOptions {
checkReleaseBuilds false
abortOnError false
}
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Steps
- In
build.gradle
aaptOptions {
cruncherEnabled = false
}
- Delete content inside
C:Users.gradlecaches
(or~/.gradle/caches
for Mac and Linux) - Restart Android Studio
Failed to read PNG signature — Just put 1 line in your build.gradle
buildTypes {
release {
minifyEnabled true
shrinkResources true
crunchPngs false // Paste this line
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Creating the .apk of an application all the resources are analyzed, if some resource has an incorrect format or is corrup you will get the message:
.png failed to read PNG signature: file does not start with PNG
signature
Be sure to have the correct resources, you can check it by opening your file.
This occurs due to the incorrect extension given to the image. For example, the image is jpg and the extension given is png.
Solutions:
- Add
{ cruncherEnabled = false }
in build.gradle - Convert the image into png rather than just changing the extension.
I had the same issue, solved by converting the images to webP from Android studio
right-click on the image -> tap on Convert to WebP
the conversion will handle file formating and also reduce the size of the PNG
In my case also there was a jpg file instead of png, so I changed my extension and solve my problem.
If you are using an online platform to generate App Icon(launcher_icon), then use PNG Format or First convert JPEG to PNG and then used APP ICON GENERATOR
You might have used a JPEG file or some other image file format.
Use PNG images to solve the error.
Drawable directory can only have png type of images.
If you don’t have any transparent pixels, then renaming the file to .jpg
worked for me.
i have same error for slow i do some step:
- open abc_btn_switch_to_on_mtrl_00001.9.png (Image)file in paint
- now select png and save as and re-save in drawable and overweight in with old images and its work
For a quick fix ,Make shrinkResources to false instead of true in app.gradle
Hope this will help.
if Not then also add this aaptOptions { cruncherEnabled = false }
This is a result of wrong file type indeed and can be fixed by saving the files in correct format.
I ran into this issue with PhoneGap Build and wanted to leave my 2 cents for any other PhoneGap / Cordova user who might also run into this.
My problem was that I upgraded my old PhoneGap 6.x to 8.0 and it seems behaviour of the default splash has changed. It used to require jpg as a default splash, but on 8.0 it results in this error on production builds.
This worked before:
<splash src="www/splash.jpg" />
Now you have 2 options. Replace the default splash with png like this:
<splash src="www/res/screen/android/screen-xhdpi-portrait.png" />
Other option is to remove default splash entirely.
I’m not sure if it’s a valid solution, but deleting only the file mentioned in the error message helped. While deleting the folder, containing it didn’t.
I was able to fix it permanently.
I created a new blank expo project, then I added a new app icon (correct png format), then I ejected from expo.
I then copied the mipmap-*
folders from the blank project to my real project. It all worked perfectly.
I’ve had the same issue. To solve it just restart your Android Studio and build the gradle file again.
You can add code in node_modules/react-native/react.gradle. After doFirst
doLast {
def moveFunc = { resSuffix ->
File originalDir = file("$buildDir/generated/res/react/release/${resSuffix}");
if (originalDir.exists()) {
File destDir = file("$buildDir/../src/main/res/${resSuffix}");
ant.move(file: originalDir, tofile: destDir);
}
}
moveFunc.curry("drawable-ldpi").call()
moveFunc.curry("drawable-mdpi").call()
moveFunc.curry("drawable-hdpi").call()
moveFunc.curry("drawable-xhdpi").call()
moveFunc.curry("drawable-xxhdpi").call()
moveFunc.curry("drawable-xxxhdpi").call()
moveFunc.curry("raw").call()
}
check it if it not fix issue after remove drawable folder
github enter link description here
You can open the images with windows win10 ‘Paint’,
then you can save as .png and overrite it,
It will solve the problem
Comments Section
The file
abc_btn_switch_to_on_mtrl_00001.9.png
is corrupt, and is not a valid PNG file.
«Deleting gradle folder» — which specific folder did you delete?
@CommonsWare the one at C:UsersRoman.gradlecaches and the one in the project
You don’t say if this is a new resource or an existing one that is now showing this symptom. This is an important detail that should be in the body of the question itself.
Try getting the support lib referenced from developer.android.com/topic/libraries/support-library/… instead of your local SDK. You can force it to grab a different version instead of 26.0.2 via dependencies and see if the problem goes away. Looks like your local SDK is corrupt if blowing away the IDE cache is still a problem.
This was our root cause as well — graphic designer accidentally saved a JPEG with a .PNG extension.
but this image is in android libraries and not for project!
@MHSFisher If you can report the developers of that library, do so, otherwise, see if you can replace the image using a standard one of your own.
Just followed Step 1 and problem solved, Thx @DiegoVenâncio, Upvoted for saving my day.
This was the problem in our project as well. Renamed the file extensions to .jpg and then used Paint 3D to convert the image extensions to .png
This fixed my issue. Thanks.
This worked for me, the error is very confusing b/c it makes it seem like your files aren’t pngs when they are. In truth, it’s crunching them that’s the problem. Since I can crunch other things and only pngs are the issue, I prefer your solution to the
cruncherEnabled
version.
Related Topics
android
gradle
android-gradle-plugin
Mentions
Zoe Stands With Ukraine
Dharman
Jorgesys
Paul
Mahdi Malv
Keshav Gera
Firze
Joseph Ajibodu
Saqib Naseeb
Parag Barsar
Ucdemir
Kumar Santanu
Benny P
Varun Barve
Prinkal Kumar
Jameel Nazir
Vikas V Shastry
Ooba Elda
Baraiya Nayan
Neetesh Maurya
References
46177560/failed-to-read-png-signature-file-does-not-start-with-png-signature
Сбой сборки Gradle с этой ошибкой:
Error:C:UsersRoman.gradlecachestransforms-1files-1.1appcompat-v7-26.0.2.aarbab547c3f1b8061ef9426f524a823a15resdrawable-xhdpi-v4abc_btn_switch_to_on_mtrl_00001.9.png failed to read PNG signature: file does not start with PNG signature
Error:java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed:
Error:Execution failed for task ':app:mergeDebugResources'.
Error: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed:
aapt2 compile --legacy -o C:devworkspaceandroid2MatrixCalculatorappbuildintermediatesresmergeddebug C:UsersRoman.gradlecachestransforms-1files-1.1appcompat-v7-26.0.2.aarbab547c3f1b8061ef9426f524a823a15resdrawable-xhdpi-v4abc_btn_switch_to_on_mtrl_00001.9.png
Issues:
- ERROR: C:UsersRoman.gradlecachestransforms-1files-1.1appcompat-v7-26.0.2.aarbab547c3f1b8061ef9426f524a823a15resdrawable-xhdpi-v4abc_btn_switch_to_on_mtrl_00001.9.png failed to read PNG signature: file does not start with PNG signature
Некоторые основные вещи, которые я пытался решить эту проблему:
- Недействительные кэши/перезапуск
- Удаление папки Gradle
Ответ 1
Возможно, проблема связана с неправильным расширением изображений.
В моем случае файл представлял собой изображение JPEG
, но он был сохранен как PNG
, не преобразованный в. В этой ситуации измените расширение на реальное и преобразуйте его в PNG, затем повторите попытку.
Для примера у вас есть ic_logo.png
, но на самом деле это JPG изображение.
Вы должны переименовать его обратно в ic_logo.jpg
и использовать что-то вроде Photoshop для преобразования изображения в формат PNG.
Ответ 2
Действия
-
В
build.gradle
aaptOptions { cruncherEnabled = false
} -
Удалить содержимое внутри
C:Users.gradlecaches
- Перезапустить Android Studio
Ответ 3
Создавая .apk приложения, все ресурсы анализируются, если какой-то ресурс имеет неправильный формат или corrup, вы получите сообщение:
.png не удалось прочитать подпись PNG: файл не запускается с PNG подпись
Обязательно наличие правильных ресурсов, вы можете проверить это, открыв файл.
Ответ 4
Я не уверен, что это действительное решение, но удалив только файл, упомянутый в сообщении об ошибке. При удалении папки, содержащей ее, не было.
Ответ 5
Возможно, вы использовали файл JPEG или другой формат файла изображения.
Используйте PNG изображения для устранения ошибки.
В директории Drawable могут быть только png изображения.
Ответ 6
Это результат неправильного типа файла и может быть исправлен путем сохранения файлов в правильном формате.
Я столкнулся с этой проблемой с помощью PhoneGap Build и хотел оставить мои 2 цента для любого другого PhoneGap/ пользователя Cordova, который также может запускать в это.
Моя проблема заключалась в том, что я обновил свой старый PhoneGap 6.x до 8.0, и похоже, что поведение всплеска по умолчанию изменилось. Раньше он использовал jpg как всплеск по умолчанию, но на 8.0 это приводит к ошибке при создании сборки.
Это работало до:
<splash src="www/splash.jpg" />
Теперь у вас есть 2 варианта. Замените всплеск по умолчанию на png следующим образом:
<splash src="www/res/screen/android/screen-xhdpi-portrait.png" />
Другой вариант — полностью удалить всплеск по умолчанию.
Ответ 7
Для быстрого исправления Make shrinkResources до false вместо true в app.gradle
Надеюсь, это поможет.
если Not, то также добавьте это aaptOptions {cruncherEnabled = false}
Ответ 8
Если у вас нет прозрачных пикселей, переименование файла в .jpg
сработало для меня.
Ответ 9
у меня та же ошибка для медленного, я делаю какой-то шаг:
- открыть файл abc_btn_switch_to_on_mtrl_00001.9.png (изображение) в краске
- Теперь выберите png и сохраните как, а затем повторно сохраните в прорисовываемом и избыточном весе со старыми изображениями и его работой.
Gradle build failing with this error:
Error:C:UsersRoman.gradlecachestransforms-1files-1.1appcompat-v7-26.0.2.aarbab547c3f1b8061ef9426f524a823a15resdrawable-xhdpi-v4abc_btn_switch_to_on_mtrl_00001.9.png failed to read PNG signature: file does not start with PNG signature
Error:java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed:
Error:Execution failed for task ':app:mergeDebugResources'.
Error: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed:
aapt2 compile --legacy -o C:devworkspaceandroid2MatrixCalculatorappbuildintermediatesresmergeddebug C:UsersRoman.gradlecachestransforms-1files-1.1appcompat-v7-26.0.2.aarbab547c3f1b8061ef9426f524a823a15resdrawable-xhdpi-v4abc_btn_switch_to_on_mtrl_00001.9.png
Issues:
- ERROR: C:UsersRoman.gradlecachestransforms-1files-1.1appcompat-v7-26.0.2.aarbab547c3f1b8061ef9426f524a823a15resdrawable-xhdpi-v4abc_btn_switch_to_on_mtrl_00001.9.png failed to read PNG signature: file does not start with PNG signature
Some basic things i’ve tried to solve this issue:
- Invalidate caches/restart
- Deleting gradle folder
17 Answers
Perhaps it’s not actually a PNG, but a JPG renamed to PNG.
The problem could be because of the wrong extension of images.
In my case, the file was a JPEG
image but it was saved as PNG
not converted to. In this situation change extension to the real one and convert to PNG then retry.
For instance, you have ic_logo.png
but it’s actually a JPG image.
You should rename it back to ic_logo.jpg
and use something like Photoshop to convert the image to PNG format.
Steps
-
In
build.gradle
aaptOptions {
cruncherEnabled = false
} -
Delete content inside
C:Users.gradlecaches
- Restart Android Studio
android {
buildTypes {
release {
crunchPngs false // or true
}
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
crunchPngs false // or true
lintOptions {
checkReleaseBuilds false
abortOnError false
}
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Creating the .apk of an application all the resources are analyzed, if some resource has an incorrect format or is corrup you will get the message:
.png failed to read PNG signature: file does not start with PNG
signature
Be sure to have the correct resources, you can check it by opening your file.
This occurs due to the incorrect extension given to the image. For example, the image is jpg and the extension given is png.
Solutions:
- Add
{ cruncherEnabled = false }
in build.gradle - Convert the image into png rather than just changing the extension.
For a quick fix ,Make shrinkResources to false instead of true in app.gradle
Hope this will help.
if Not then also add this aaptOptions { cruncherEnabled = false }
If you don’t have any transparent pixels, then renaming the file to .jpg
worked for me.
You might have used a JPEG file or some other image file format.
Use PNG images to solve the error.
Drawable directory can only have png type of images.
I had the same issue, solved by converting the images to webP from Android studio
right-click on the image -> tap on Convert to WebP
the conversion will handle file formating and also reduce the size of the PNG
I’m not sure if it’s a valid solution, but deleting only the file mentioned in the error message helped. While deleting the folder, containing it didn’t.
This is a result of wrong file type indeed and can be fixed by saving the files in correct format.
I ran into this issue with PhoneGap Build and wanted to leave my 2 cents for any other PhoneGap / Cordova user who might also run into this.
My problem was that I upgraded my old PhoneGap 6.x to 8.0 and it seems behaviour of the default splash has changed. It used to require jpg as a default splash, but on 8.0 it results in this error on production builds.
This worked before:
<splash src="www/splash.jpg" />
Now you have 2 options. Replace the default splash with png like this:
<splash src="www/res/screen/android/screen-xhdpi-portrait.png" />
Other option is to remove default splash entirely.
i have same error for slow i do some step:
- open abc_btn_switch_to_on_mtrl_00001.9.png (Image)file in paint
- now select png and save as and re-save in drawable and overweight in with old images and its work
I’ve had the same issue. To solve it just restart your Android Studio and build the gradle file again.
In my case also there was a jpg file instead of png, so I changed my extension and solve my problem.
You can add code in node_modules/react-native/react.gradle. After doFirst
doLast {
def moveFunc = { resSuffix ->
File originalDir = file("$buildDir/generated/res/react/release/${resSuffix}");
if (originalDir.exists()) {
File destDir = file("$buildDir/../src/main/res/${resSuffix}");
ant.move(file: originalDir, tofile: destDir);
}
}
moveFunc.curry("drawable-ldpi").call()
moveFunc.curry("drawable-mdpi").call()
moveFunc.curry("drawable-hdpi").call()
moveFunc.curry("drawable-xhdpi").call()
moveFunc.curry("drawable-xxhdpi").call()
moveFunc.curry("drawable-xxxhdpi").call()
moveFunc.curry("raw").call()
}
check it if it not fix issue after remove drawable folder
github enter link description here
I was able to fix it permanently.
I created a new blank expo project, then I added a new app icon (correct png format), then I ejected from expo.
I then copied the mipmap-*
folders from the blank project to my real project. It all worked perfectly.
If you are using an online platform to generate App Icon(launcher_icon), then use PNG Format or First convert JPEG to PNG and then used APP ICON GENERATOR