I have search all the possible available solution but still i am facing same issue with unclear error for me.
Now the complete error is-
AAPT err(Facade for 370671127): libpng error: Not a PNG file
Error:Execution failed for task ':app:mergeDebugResources'.
Some file crunching failed, see logs for details
Now from this line libpng error: Not a PNG file actual i am not getting where is the problem exist either in my any image files or anything else except this.
1- Before posting this issues i have changed my all the images existing in the diff-2 folders in required PNG formates as I see as solution in other post.
Note- Its working fine on eclipse now I am importing this in Android Studio.
Since during project build only single(above) error is shown so I guess there is not should be any other issue. I have spend more time to resolve this issues so all the suggestions are welcomes for me.
The problem is in your png files. Probably you images were optimized by some png optimization tools. Android tools use AAPT tool to optimize images during building your project. The reason for this problem is that AAPT tool doesn't know that you preprocessed the image.
To get around this in your application you need to specify the option in gradle
aaptOptions{
cruncherEnabled = false
}
This is disable AAPT optimization for all of your png files.
Similar question was asked here.
Although there can be various reasons for this error , i.e Can't resolve symbol R
But In particular, If the problem is saying Not a PNG file
My Case
For me ,it was a jpeg file that I had saved with extension .png which was the root cause
Solution
remove that jpeg image from your res/drawable folder
Note
renaming a jpeg to png doesn't mean it is a png in android studio... so get rid of that jpeg image
rebuild..
voila.. it works
hope it helps :)
Related
I can't build my AAB because both in Unity and in Android Studio (when exporting the project) it fails with this error:
file 'root/res/drawable-xhdpi/ic_launcher.png' uses reserved file or directory name 'res'.
I searched up a lot and I can't find a valid solution to this issue, and I can't think of a way to avoid it since the files it refers to are added at the moment of building. Can anybody help me with this? Thanks a lot.
I used to react-native-svg-uri plugin until the illustrate images with SVG's format in app, but when I want to build the apk in the project, occur error and tell the change SVG's format to png or jpeg. how to fix this problem?
Error:Execution failed for task ':app:mergeDebugResources'.
C:\Users\user\AndroidStudioProjects\BrainTrain\app\src\main\res\mipmap-hdpi\USER-PC.eml: Error: The file name must end with .xml or .png
This error as been occurring ever after closing my Android studio
You put a file, named USER-PC.eml in res/mipmap-hdpi/. That is not a valid filename for that directory (wrong extension, dashes not allowed), and quite possibly it is not a valid file for that directory.
So, remove it from the project for now.
So I have third-party JAR and AAR files in my platform/android folder in my Appcelerator/Hyperloop project
When I tried to run my app, I encounter these errors:
[ERROR] : /Users/myusername/Documents/Appcelerator_Studio_Workspace/TestApp/build/android/res/drawable-ldpi-v4/awsdk_beta_badge.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
...(same error for different png files)
[ERROR] : /Users/myusername/Documents/Appcelerator_Studio_Workspace/TestApp/build/android/res/values/values.xml:817: error: Resource entry app_name is already defined.
[ERROR] : /Users/myusername/Documents/Appcelerator_Studio_Workspace/TestApp/build/android/res/values/strings.xml:3: Originally defined here.
I tried modifying the images using ImageMagick as suggested by in similar threads to this issue, but that doesn't seem to help because every time I click Run in Appcelerator Studio, the image files in the build/android/res folder are overridden (i.e. re-created and replaced) for each and every build. Is there a way to prevent these image files from being modified every time I click Run or is there any other way to resolve this issue?
I modified the png files via ImageMagick by changing current directories to the directories specified in the error messages and ran this command on each of those directories with the images: mogrify *.png
I am trying to run a Phonegap application but some images in the resources directory are preventing it from starting. when i delete the images files from my project it works just fine.
Execution failed for task ':mergeDebugResources'.
Error: Failed to run command:
/Users/macbookpro/Library/Android/sdk/build-tools/22.0.1/aapt s -i ../platforms/android/res/drawable-land-xhdpi/screen.9.png -o ../platforms/android/build/intermediates/res/debug/drawable-land-xhdpi-v4/screen.9.png
Output: ERROR: 9-patch image ../platforms/android/res/drawable-land-xhdpi/screen.9.png malformed.
No marked region found along edge.
Found along top edge.
First remove all your splash.png files and clean your cordova project by using this command ./platforms/android/cordova/clean
then copy the splash.9.png files in your res folders
then build the project, that worked for me.
You can make .9.png files with the help of this online tool