Xcode 14
When I push to the main branch of my repo Xcode Cloud fires up and ideally should run my test suite. However I cannot make it to the testing phase because I get this message:
Could not resolve package dependencies:
Package.resolved file is corrupted or malformed; fix or delete the file to continue: unsupported schema version 2
I’m also on Xcode beta but I doubt that has any relevance here.
Also to be clear the popular solution of deleting Package.resolved
is not working. Xcode just autogenerates the exact same Package.resolved
.
2
Answers
Your local Xcode of a newer version generates the Package.resolved file in a newer format that can’t be read by older versions of Xcode.
One of solutions for such scenarios is git-ignoring the Package.resolved file and let your cloud build system resolve packages on its own.
Another solution is to keep your local and cloud Xcodes synchronized in versions – this should ensure compatibility.
And one more solution is to revert changes of the Package.resolved file in the remote server (which means partial rewriting Git history by force-pushing) and never commit them until the remote Xcode is updated. (This might also lead to fixing Swift packages versions to older ones than in the local copy of the repo.)
After upgrade to Xcode 14. Some of my local packages cannot be resolved.
Error message likes:
I solved this problem by change my local Package.swift from
// swift-tools-version:5.5
to// swift-tools-version:5.3
.