When I try to build an iOS application the XCode gives me the error which says
error: can't exec 'copypng' (No such file or directory)
Command copypng failed with exit code 71
So the problem isn't in missing PNG files or something like this, the problem is in the file that should does copy. I met this error for the first time and google says nothing.
How do I fix it?
I guess you stated, that you want to copy file, while there is no such file. Go to Project->Target->Build Phases->Copy Bundle Resources and find 'copypng' file (should be highlighted in red), and delete it (as it doesn't exist anymore).
On image attached to your question I see info that system couldn't copy files LaunchScreen-iPhoneLandscape.png and LaunchScreen-iPhonePortrait.png.
Normally, if you have Images.xcassets in project there should be "LaunchImage" image set. But it is alsoo possible that these .png files are placed directly in resources. Name for launch image used by target is set in "Asset Catalog Launch Image Set Name" in target's Build Settings. Make sure name for Launch image in xcassets (or in .png file in targets sources) matches.
If they are, check if target membership is correct (otherwise they won't be seen by compiler). Last thing to check - check potential problems with LaunchImage files according to the instructions in link from Adamsor comment.
For example - check if all necessary file sizes are in place, try opening and re-saving these images in editor. Maybe format is not right and that will be enough to fix it.
I've reinstalled XCODE and now all is ok.
Related
I'm trying to delete all the unused assets, to decrease the app size (icons, launch screens, etc), I started with the iOS project, but now I'm getting errors like this:
Bundle Resource 'Icon-Small#3x.png' not found on disk (should be at
'D:\Work\MyProj\MyProj\MyProj\MyProj.iOS\Resources\Icon-Small#3x.png')
I deleted the specified file, but it's not used in the project, at least it's not visually used. Some of the missed files are the default Xamarin X icons.
I deleted the array items in CFBundleIconFiles key, which pointed to all the missing files, but still getting the same error.
I don't know well about xamarin. But in Xcode, the images files are removed from Xcode better than from Find file utilities.
The project has a directory, .xcodeproj. And a file project.pbxproj will describe how many files will be compiled, and how many images resources in this project.
If a image file was deleted from file system, but it is still in this project.pbxproj. Then the compiler will argue this problem about it failed to find the image resource file.
So, deleting a image file in Xcode, will remove the entry from project.pbxproj and remove it from file system.
In Xcode, it will mark red colors for those missed files, I think xamarin should has similar feature too.
In iOS , some icons are required . Items marked with "Required" must be included.Refer the following image.
As we can seen ,Icon-Small#3x.png is required.It used for seetings on device (such as iPhoneX and iPhoneXs Max).Such as the icon in the following image.
So ,though you have deleted the array items in CFBundleIconFiles key.You will still get the error .
The reason you are getting this error is chances are you deleted the source files, but Xamarin still keeps on referencing them.
So resolve this error go to each folder, Resources and Resources/Drawables on android and delete each image separately. This should fix your issue
Ok, my problem seems to be similar to this, and this, but following the answers, there is not helping me. This might be because I am using Xcode 5, before I upgraded to this version I wasn't having any problems with this app.
When I validate my app I get the following error:
"Invalid Image Path - No image found at the path referenced under key
'CFBundleIcons': 'icon152'"
So I go to the .plist file in Xcode, right click Show Raw Keys/Values and find CFBundleIcons.
There is a tree that looks like this:
▼ CFBundleIcons Dictionary
▼ CFBundlePrimaryIcon Dictionary
▼ CFBundleIconFiles Array
Item 0 String icon152
Now I've renamed icon152 to icon152.png, and it still doesn't work. Does this value require the full path to the image on my mac? And if it does, why am I not getting the full path inserted when I add the image from scratch? I've validated apps before and never experienced these problems.
I've tried removing all the icon entries out of the .plist file and re-adding them, still doesn't work.
I've tried removing the images from the bundle and Xcode altogether, and completely re-added them from scratch. Still doesn't work.
Can anybody tell me what I am doing wrong?
EDIT:
If anybody else is struggling with this, all I did to solve it was click the "Use Asset Catalog" button - and all these problems disappeared. You can find that button by clicking on your project in the Navigator, then under General scroll down to App Icons - the button should be there.
I had the same error as ckoskar,
"Invalid Image Path - No image found at the path referenced under key 'CFBundleIcons': 'icon120x120'"
I ended up deleting the file from the CarPlay section in the AppIcon part of Images.xcassets, and then I was able to submit the build.
I had the same issue, and the "Use Asset Catalog" worked for me. Maybe take it out of the resources, put it back in, clean, build and then see if it works.
To find this button : Project > General > App Icons and Launch Images
Here is what worked for me:
Select the Target
Go to Build Phases
Expand the Copy Bundle Resources
Go to the bottom of the panel and select the + sign.
Add each of the missing resources.
Can you try removing the icon from the project and adding them again? Then try to use the name without .png.
Sometimes Xcode can't see the changes if you modify the file in Finder.
I too had the same issue, the interesting thing was that I was already using the asset catalog when this happened. The solution that ended up working for me is described here:
Invalid Image Path - No image found at the path. CFBundleIcons Xcode 5
Basically you need to add the image to the target you are building. To do that, select the image in the list of files under your project in the Navigation Pane, then show the Utilities Pane on the right and check the target under Target Membership in the Utilities Pane to the left
Sometimes that happens when you add files separately.
Make sure you have the Build name's check box checked on the "Target Membership" area in the Utilities pane.
The files for which it is throwing an error would have that check box unchecked hence it does not get included in the final build.
By checking this checkbox I got my problem solved. Thank DomandoCoder!
I had problem with:
"Invalid Image Path - No image found at the path referenced under key 'CFBundleIcons': 'icon120x120'"
The solution was to move the icon (120x120) to a another appicon folder
I had the same problem. I was trying to get a Free and Full version app to upload. The free app TARGET uploaded fine though I had problems with the Paid TARGET. I selected all the images used for icons in the PAID and FREE versions and then looked at : FILE INSPECTOR --> TAGET MEMBERSHIP -> make sure to check them both and then it'll be OK. Worked for me.
Here's the error I had:
Then I selected and checked these for PAID and FREE versions of the app:
I hope this helped. Check out roulette tracker and my other apps!
Please vote if this helped you.
Well for me it was not any of these. I kept adding and cleaning to no avail
there was list of icons in the plist under:
CFBundleIconFiles~ipad and CFBundleIconFiles
There were a few in there that did not exist. I removed/ updated and that seemed to work.
Make sure the image is added to the project:
expand the Resources folder
if the file is there remove it
if the file is not there add it by right clicking the Resources folder
clean the build and rebuild
What solved to me was to check the icons that are failing and open them in preview and export as png again.
No changes in XCode, only new export of the images.
I had the similar issue with an error about iTunesArtwork and warning about 120 icon and the "Use Asset Catalog" worked for me where I filled the missing icons by dragging from project navigation pane and didn't do anything with iTunesArtwork though.
Edit:
My previous solution didn't work this time for same error for my react native app. My faulty icons images were causing this very issue. I opened one of the icon in Preview and selected the whole image area and created new image from clipboard. I replaced all the old images by these newly created images and upload went successful.
You can get this issue if your app icon name aren't correct.
I was using appicon.co which was generating wrong names that's why I was getting this error. Then I used "Icon Set Creator" iMac app to generate icons & everything worked fine after using them.
I had the error "Invalid Image Path - No image found at the path referenced under key 'CFBundleIcons': 'icon40x40'"
In my particular case I was just missing the 80x80 (40x40 scale x2) icon in Images.xcassets. The error message excludes the scale of the icon.
Adding the missing size resolved the issue for me.
While reading /Users/user/Desktop/AppProject/PruebaApp/Logo Retina.png
pngcrush caught libpng error:
Read Er Could not find file:
/Users/user/Library/Developer/Xcode/DerivedData/PruebaApp-cblepoaxbqzyopcbcswwqjtftyon/Build/Intermediates/ArchiveIntermediates/MaderoAPP/InstallationBuildProductsLocation/Applications/MaderoAPP.app/Logo
Retina.png
Command
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng
emitted errors but did not return a nonzero exit code to indicate
failure
Im getting these errors while archiving project, at the end it does archive but i want to get rid of it. I had trouble with the app before and i read that i should delete the DerivedData/(myproject)folder so i did. and apparently it is trying to look for the images in that folder how do i fix this??? Help!
Try first by Hard Cleaning your project CMD+OPTION+SHIFT+K, If problem exists apply following method,
Build Phases -> Copy Bundle Resources, Any fileName is red color?
Or
Convert Logo Retina.png or Create it again, maybe it's an encoding\format issue.
Or
Rename "Logo Retina.png" to "LogoRetina.png".
~Good luck~
It also happens when you have multiple images with the same name in TARGET->Build Phases->Copy Bundle Resources. To resolve it -
Search for the image name that you are getting an error for in Build
Phases search bar at the top.
If you get multiple results in Copy Bundle Resources for the search query, just remove others from it by clicking on "-" sign. Make sure you have same images for the multiple results. If not you have to rename the actual files of other entries.
Just compile your code. You are good to go.
Hope it works for you.
Just open image in Preview app and export it as png file. Replace old image with new in Xcode.
Honestly I have had this problem intermittantly many times and clean then rebuild has fixed it.
Since the answers here are either not useful at all or quite complicated I want to add mine:
The error means that Xcode can not find the file, whether it is in the project's folder or not.
If you still need that image, what you can do is to open a Finder view and navigate to your project. Drag the file Xcode was complaining about into the project an uncheck 'Copy to folder'.
if you do not need the file anymore, on the left side of Xcode, find the file, it will be shown in red, simply tap on it and then delete / backspace
Hope that helps some people :)
To solve the issue copy the Image name. Then Filter it (Build Phases -> Filter textfield). Finally I removed it.
Also check that you are not naming the images with only a number like "0.png" I change it to "tuts0.png" and it worked.
I just had this error and honestly I think it was being caused by another error. I had an issue with my Crashlytics framework and I'm convinced it was effect some unassociated pngs with the copypng error. I replaced the Crashlytics.framework with a fresh version and viola, all errors were gone.
Don't ask me how this works, I'm just posting this in case someone else can benefit from it.
I wasn't able to fix this problem. So i delete and reinstalled xcode, this helped for me.
Fixed it by reverting to my old product name (in "Build settings"). Seems that the new product name confused the images path.
I have the same issue with resources. The problem was that I have copied target from another one and just forget to uncheck checkbox at target membership window.
i face this problem and this solution is working form me
you need to remove any reference for that image
Build Phases -> Copy Bundle Resources
after that clean and build and problem will be fixed
I had accidentally deleted the file from the location which was linked to x-code project. I had not copied the file in my xcode project but just the path. Hope it helps someone.
I've had similar issues with pngcrush /libpng crashing with PNGs (checksum errors / freeing object that have been freed etc). These could be reproduced on the command line so I recreated the PNGs, even converted them to other formats then back but the errors persisted. In my case Xcode then rejected the resulting archive for not having iPhone 5 support (as pngcrush killed the Default-568h#2x.png image). The above fix resolved this.
For those who are struggling with this error while building Cordova app.
Please keep the following point in consideration as it may lead to this error.
The images should be tagged as "resource-file" and not as "source-file" in plugin.xml of your Cordova plugin as the former includes the images in "Copy Bundle Resources" (under Build Phase) and the latter to "Compile Sources" of your equivalent xcode project of cordova app.
If non of above answers can fix your problem, try look into Xcode project where you reference your image file, I happened to referenced twice to the same png file. Once I delete one the reference, it worked. The error went away. Good luck.
It also happens when you have multiple images with the same name in TARGET->Build Phases->Copy Bundle Resources. To resolve it -
Search for the image name that you are getting an error for in Build Phases search bar at the top.
If you get multiple results in Copy Bundle Resources for the search query, just remove others from it by clicking on "-" sign. Make sure you have same images for the multiple results. If not you have to rename the actual files of other entries.
clean cmd+option+shift+k and Build Project...
work well for me....
The app builds fine in a simulator and on a device. But as soon as I try to archive it for submission I get:
While reading /Users/adga/Documents/Adams Lokalt/Appar/NU SÅ/VertragingsApp/Rotation/Customization/Herfst2011/../../../default#2x.png pngcrush caught libpng error:
PNG unsigned integer out of range.
I've tried to open in photoshop and replace (without interlacing) but it doesn't work.
Any ideas?
I receive such error when just try to run my project.
This error could occur when you have duplicate file references (I have this problem because I change my png images). You can check, all of your copying files in Bundle Resources and for me there was more than one copy of each "error png file".
You can open Bundle Resources following this steps: click on your project name in Project Navigator tab, then choose your project in Targets. After that, you must choose Build Phases tab. You'll see a list of items: "Target Dependencies", "Compile Sources", "Link Binary With Libraries", and what we're looking for Copy Bundle Resources. Here you can see all your resources that you add to your project.
To fix this error, you must remove all error files from this list.
After that you also delete this files in Project Navigator, choose all files that needs to unlink from project, than right click on them and choose delete, then choose Remove Reference. All we need is to remove all references from our project.
All things done, right now we must add our files back. Click to Project Navigator zone with right button (or to a particular folder/group) and choose Add Files to "Your Project Name" and choose all files you need to delete.
Remember, that you remove reference from files previously and they are just waiting to be added again in your project folder.
Another reason when such error occur is when .png file is not a proper .png file, in this case you need to re-save file to png extension. You can open your image file in Preview and save it to png from here. If you have a big amount of images, you can use Automator to help you in your task. Hope this help.
I faced the same issue as well. I just restarted xCode and recompiled. I did not have that problem thereafter.
I met this problem too. Though the project still could be compiled, it is really annoying.
I resaved the png without interlacing to another place and replace the original one instead of just resaving it at the original place. This did work for me, why you just try this again?
I received this problem when I added two images to a project that already had references to them. Once I removed the duplicate reference, the error disappeared.
I had the same problem and error disappeared after simple step in photoshop. Open your existing png file with photoshop and re-save it as "Save for web & devices"...that did the trick for me!
I have a strange problem in my project and can't figure out a way to fix it.
It manifest itself when I Archive the project. If I just build it, all is OK.
This is the error I get...
While reading /Users/jorgen/Desktop/isengua-en-de_120125/Airship/UI/Default/Subscription/Resources/Shared/middle-detail#2x.png pngcrush caught libpng error:
Read Error
However the actual file that it can't read changes. I have checked that it there and that it can be opened. It is always the Airship files, but it can be in Push, StoreFront or Subscriptions.
Also in the same project I have a problem with the icon.
warning: iPhone/iPod Touch: isengua_ENE-DE_114+.png: icon dimensions (0 x 0) don't meet the size requirements. The icon file must be 57x57 pixels, in .png format (-19014)
Unable to validate your application. - (null)
The icon for Retina is 114x114 and the other is 57x57. Again I have checked and double checked this.
I have gone back to a copy I had two weeks ago, and the same thing happens.
Grateful for any help.
If it only happens when you archive then the error happens when attempting to package/move all the files required into the the archive folder. Building just pulls from the referenced location.
Easy fix is just remove the files and re-import. 2 files would no be a big hassle.
Also you could peek at your info.plist and/or your copy bundle resources and confirm that everything points to the right files.
None of the answers worked for me but this did.
I check in the resources folder i.e. not the www folder, so:
PROJECT-NAME/PROJECT-NAME/Resources/splash
in that folder there should be a copy of the same Default.png and Default#x2.png that are in your www folder.
when i checked they were the phonegap defaults. I replaced them with a copy of mine from the www folder. Did a clean and a build and it finally worked!