Xcode: remove working copy - xcode

My git repo suddenly has two working copies in Xcode. It sends the commits to both the original working copy and a working copy that is actually my repository from a completely different project.
I have tried this answer but there is no xcshareddata folder in my project.
How would I remove the wrong working copy?

Apparently two files imported from the other project caused this to happen. To fix it I removed the files and imported them again by copying them to the project's folder.

Related

In my iOS Xcode project, files added to .gitignore are still persisting and being updated in the project.pbxproj file

GoogleService-info.plist, Development.xcconfig, and GlobalVariables.swift have all been added to the projects .gitignore file.
Upon cloning the project from GitHub, all of the ignored files in the setup folder are greyed out.
The files should not be contained in git, as developers are to create them upon cloning the repo, add their own private keys (based on their own firebase backend), in order to do local development.
Issue #1:
Currently, the ignored files still appear (but greyed out), and developers must first delete the files, before recreating them. (this is due to the ignored files still persisting in the project.pbxproj file).
Issue#2:
The deletion & recreation of the files causes a change to the projects' project.pbxproj file, specificically, the files are recreated in project.pbxproj with a different fileRef number.
Issue#3:
Merge conflicts due to different fileRef numbers:
If two developers both clone the repo, both delete the 'greyed out' files and recreate them, the recreated files will have a different fileRef in the project.pbxproj file.
Each developer will have to perform an additional commit to account for the changes in the project.pbxproj file, and upon pushing the code to the remote repository, there will be a merge conflict in the project.pbxproj file.
The goal of adding the files to .gitignore was to keep each developers added code secrets out of git (Which it is still currently accomplishing).
However, is there a way to ensure that files added to .gitignore are also kept out of the ```project.pbxproj`` file?
Goals:
1) The files in .gitignore should not appear in the Setup folder upon cloning.
2) The creation of the files that have been added to .gitignore should not be added to the project.pbxproj file at all
3) Developers should effectively be able to clone the repository and create the setup files without any changes occurring in Git.
Any feedback on how to accomplish this is appreciated in advance.
To Clarify:
The files added to .gitignore are properly being ignored by git, the issue is that the created files are still being added to the project.pbxproj and persisting there, where they ideally should not be.

Error:null value in entry: incrementalFolder=null

I am getting following error in gradle build.
Error:null value in entry: incrementalFolder=null
How can I fix this?
I agree with Maravilho Singa's answer. It appears to be a bug in gradle.
I found another solution here:
removing the .gradle directory in the root project directory will fix the problem.
Just delete the .gradle directory and rebuild app.
Undo Try to bring back .gradle directory. There by your error will be removed.
I think it has something to do with iCloud. I've found that each time that happens with my projects it's because the .gradle file had been uploaded into iCloud and was no longer available in my computer. So either delete the .gradble file and have it regenerated, or recover it from iCloud by clicking it.
Empty all "build" folders in your project
Copy all your project files and folders
Create a new folder and past it there
Open android Studio and import project
Wait Android Studio to download all dependecies.
That's all. It will work perfectly
delete the .gradle file from the root directory and then clean the project, by this your .gradle file be recreated and your error will be resolved.
This is gradle bug. Go to your project folder, delete your gradle and build folder. Sync the project with gradle files. This will resolve the problem.
I am working on my project and suddenly lights goes off, When i started Android studio and run the project, At the moment Android studio syncing the Gradle, And the same problem occurs.
Solution=>
Please Tack Backup of your project before proceeding these tasks.
Delete All folder and files present in Build folder and Gradle folder.
Uploading Images That will help you.
Error:null value in entry: libOutputDir=null
put any new projects .gradle file into your app but before that you must backup your app. i solved this error using this method.
I hope its works for other.
I resolved my error by removing the .gradle as well as .idea directory from the root project directory.
I had the same issue. importing files into a new project fixed it for me.
I stuck in the problem like this. What I done is Delete the .Gradle Folder From the Project File.
Then Built and Clean the Project. Certainly my problem is only resolved by this.
Delete .Gradle Folder -> Clean->Built
Delete the .gradle Folder from root project that showed in the top of the root project.

Xcode 7.3 - Throwing "directory not found for option" Even if The Directory Did Exists

I am getting this warning a couple of times stating that the library directory is not found. I've tripled check the directory, and IT IS THERE. I tried to clean the project but still didn't work.
The strange thing is, when I remove the library(The whole folder) and copy-paste a new one, it will work - What I mean here is I deleted the source file from the main directory of the project and copy-paste a new one from another directory, then I will add the files to the project.
But after building a project for a couple of times without editing the directory or the contents of the library, this error will happen again.
It's like, when I fix this problem, it will be OK for now, but when I rebuild the project next time without editing anytime, the error will occur again.
I am not sure if this case has something to do with path containing spaces.
Instead of copying and pasting the directory you should: File > Add Files ... to your project. Xcode is likely losing the reference to it because the files are not "added" to the project.
I solved this problem by removing the space within the directory name. My directory name before was Name Name, Then I changed to NameName. Now the problem is gone. It's really strange, I don't think spacing would produce such problem.

Dereferences a xml file from xcode

I made a huge mistaking in renaming my xml file from xcode and I'm not sure how to fix it. My app has a feature that reads all local xml files built with the project. So now it is reading 2 of the same xmls with different names.
I tried deleting the file, added it back in, and Dereferencing it but no luck. I also made sure to delete my app and re building the project. When I do a full system scan for the xml file nothing pops up. The xml file is currently in the Trash.
Another issue might have been with the svn remote server but I tried svn rm --delete filename and it said the file does not exist. ( I tried the project directory as well as a few other sub directories).
Is there a way to Dereference/delete the file from the project?

Xcode 4 project: utility to clean up pbxproj file?

I have an Xcode 4 project with 2 targets, one for iPhone and one for iPad. If I click on the iPad target and try to go to Build Settings Xcode 4 crashes:
Encountered multiple assertions. First assertion was: ASSERTION FAILURE in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-269/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/FileTypes/../PBXFileType.m:594
Details: filename should be a non-empty string, but it is nil
Obviously the pbxproj file has a bad reference in there somewhere -- likely caused by the many manual merges I've been forced to do by git. Is there some way to clean up the pbxproj file so it works correctly again or to tell which line is causing the problem?? I'd really really prefer not to have to recreate the project from scratch.
I tried gorbster's method with no success (though it has solved similar problems for me in the past).
I went into my project.pbxproj file (inside the .xcodeproj package for the project) and found two lines that looked a little suspicious, both of the form:
53A45F8F138FE6F40077017F /* (null) in Resources */ = {isa = PBXBuildFile; };
I deleted the lines, and voilĂ : I can access my build settings for this target again.
No idea how they got in there in the first place. I would guess something to do with a faulty merge under SVN.
Ran into the same issue this morning after pulling a colleague's merge.
I was able to fix this with the following:
Close Xcode
Open the .xcodeproj package in Finder
Delete the project.xcworkspace file/package
Open the xcuserdata folder and delete your user-specific .xcuserdatad folder.
Re-Open Xcode and project
I lost some minor user preferences (file and tab history, etc), but can now click all (9) of my targets without issue. Turns out my colleague was on an earlier version of Xcode, but I'm not sure if this contributed to the IDE crashing.
Ben Mosher found the solution.
And yes it is due to SVN merge problem.
As we working in team with SVN the error occur often so I wrote a bash script:
#!/bin/bash
sed "/(null) in/d" project.pbxproj > tmp_project.pbxproj
mv tmp_project.pbxproj project.pbxproj
Try the following steps while your Xcode is closed.
Go to your {YOUR_PROJECT}.xcodeproj file in finder.
Right click on the {YOUR_PROJECT}.xcodeproj file.
Choose Show Package Contents ... this will open the contents in another Finder screen.
Open file project.pbxproj and search for all lines having string "(null) in"
Delete all lines having (null) in ... no worries.... delete confidently.
Save your file.
Now open your project using Xcode and try to open the Build Settings tab... hopefully your problem will be solved.
Thanks,
Mohamed.
Right click your .xcodeproj file and "Show Package Contents".
Then open project.pbxproj file with TextEdit and duplicate.
Save duplicate file anywhere with same name and extension. (project.pbxproj)
And replace with the old file.
In case you also tried the remove (null) reference lines and deleting the user-specific .xcuserdatad folder, and those did not work, here is a potential solution. FYI... This was experienced on Xcode 7.3.1 .
Here is the scenario I faced:
I experienced this issue that was triggered by having "twin" branches in a git repo... (i.e. one branch BRANCH_A is a development branch with some features not due for release, and another that had the same commits except for the new features, call it BRANCH_B).
The development work flow is as follows: start with BRANCH_B, create a commit branch CHANGE_C, make changes and commit, then checkout BRANCH_A, create a commit branch, then cherry-pick changes from CHANGE_C. BRANCH_A is tracking BRANCH_B in this way, with its additional feature files.
In my case, (for some reason during rebasing on co-worker changes from the remote that BRANCH_B tracks, the project file for BRANCH_B got corrupted.
In this case, the solution is to save a copy of the project file for BRANCH_A (which is good and compiles), then checkout BRANCH_B, and replace its project file with the copy.
Initially, it will not compile, until all references to the feature files (from BRANCH_A) are removed from Target's Build Phases > Compile Sources.
Works great.

Resources