R.java won't generate. Thoroughly searched for solution. Cleaning doesn't help, I have no errors in xml or res names - r.java-file

Yesterday I walked away from my computer for lunch and when I got back my codes were filled with red lines. I discovered my R.java had been deleted after cleaning. I have spent several hours looking at solutions and nothing works. I tried cleaning, building, deleting gen folder, deleting debug file, starting a new project and putting my project files in that new project. I have no errors in xml and all of my res files are named correctly. When I start a new, blank project, the r.java is there until I usually try to reference something in the setContentView(R.layout.xxxx.); command.

Related

Visual Studio 2019 Always Rebuilds, Doesn't Make Changes

As the title says, VS 2019 is rebuilding regardless of changes, and isn't actually compiling a new version of my dll unless I delete the old dll.
I've tried deleting the bin, obj, and .vs files, as well as simply moving all of the files and creating an entirely new project with the same files, with no luck. I also updated to the latest version. It has no statement on whether or not the project is "up to date" (or ctrl-f isn't finding one in the build output.) The only things I remember changing were just some lines in one of the cs files. This is what I get for not setting up the project on github :(
I attempted to paste the "verbose" build output into hastebin, pastie.io and pastebin, and it was too big :/
If there's something else you need, reply saying what it is and I'll supply it. If there's something you'd like me to find in the build log, or if you'd like me to upload the build log somewhere, I can do that to.
EDIT:
I have the 'verbose' log, it is lacking the 'out of date' message explaining why the rebuild is necessary.
It is a singular project dependent on nothing else.
In true Visual Studio fashion, the problem fixed itself. I've included the troubleshooting steps I took in hopes they may help someone with a similar issue.
Delete the '.vs' folder
Delete the 'bin' and 'obj' folders.
Readd project references.
Create a new project with the same files.
To be clear none of these solved the issue. It still built every time, outputting '1 succeeded, 0 failed, 0 up to date' at the end, while not actually replacing the old dll. As a workaround, I manually deleted the dll before every build, which caused it re-build it correctly. Eventually, it just stopped having the issue. I would assume whatever lines of code I added that caused the issue were removed/edited.

Errors on build in a file that doesn't exists anymore/was renamed

I have a few t4 templates in my solution and at some point I renamed the the files and made some changes to them. When I did a build I got the above errors. Interestingly enough when I click on the file names nothing happens and when I hover over them to get the full name I notice that it's referencing the file name that I changed earlier. Also I've gone to all the files it could possibly be referencing and made sure that this error is not occurring in any of them.
I've tried cleaning and rebuilding, ensuring that all the projects are configured to build in the configuration manager. I deleted the file that I renamed and recreated it and the errors were still present even while the file was delete. Also I tried creating a file with the exact same name as the one referenced in the error message and it actually let me create the file, indicating that vs clearly knows that there is not file with that name so it seems to be a problem specifically with the debugger maybe?
I suspect this could be some strange behaviour with t4 templates as I feel like something like this happened before. A full restart of my machine was what solved that last time but it didn't work this time.
Ok so after hours of unsuccessfully scouring the internet I noticed that the 'CustomTool' field in the file properties had a typo in it which was causing the strange error.

Xcode keeps deleting 2 files

I have an Xcode project using Xcode 8. I am using Swift if that helps/matters.
A few days ago after really not changing that much except a few funcs in one VC I tried to rerun my app and it had an error (I can't remember what it said unfortunately...but when I google'd it said basically that there was a file missing)
I located what the files were and just copied all changes into a blank project and deleted the file and pulled from Github a clean version and re adde the few funcs I added.
Everything was great and nice, until yesterday I noticed 2 yellow warnings.
I clicked the "Issue Navigator" and it is saying
TestApp project missing file
TestApp.debug.xcconfig is missing
Pods project missing file
pods - TestAPP.debug.xcconfig is missing
I realize that files just don't randomly disappear, but honestly I did not touch anything other than the Storyboard and the one ViewController File I am working on.
Why does Xcode keep deleting my files?
Is this project savable or do I need to start it over (is it corrupt?)
My project also is using Firebase.
xcconfig files are used to separate out build configuration information. Those errors are showing that you're missing entries corresponding to a debug build.
Nothing should be touching them. Only three possibilities come to mind:
You didn't create debug configs in the first place, but have tried to use them somehow.
Your path configurations are placing these in a directory that's getting wiped out when you clean/rebuild your app.
The project directory is under git control and you're doing something with git that removes the files.
Here's a screenshot showing I have two configs under my Pods project, one for "release" and one for "debug".
You might try setting up your project and making sure you see the debug configs listed. If so, see where they're kept and so on to diagnose what's going on. Otherwise, you just haven't created them.
My guess is that the files are not actually missing in any serious way. It's a bug related to use of git (as you say, the files came thru GitHub, so we know the project is tracked thru a git repository). The files were removed, but this is in fact not a problem. If that's right, then, as I explain at https://stackoverflow.com/a/39715083/341994, you can solve this simply by doing a git add or git commit of these files. That will cause Xcode to become happy and the warnings will go away.

VS 2015 Xamarin: Warning IDE0006 Error encountered while loading the project

I am developing an Android app using Xamarin.
Visual Studio shows this warning, and I don't know what it means. I've followed the instructions but I can't seem to find the temp\\file
Severity Code Description Project File Line Suppression State Detail Description
Warning IDE0006 Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled. daijoubu-app 1 Active To see what caused the issue, please try below.
1. Close Visual Studio
2. Open a Visual Studio Developer Command Prompt
3. Set environment variable “TraceDesignTime” to true (set TraceDesignTime=true)
4. Delete .vs directory/.suo file
5. Restart VS from the command prompt you set the environment varaible (devenv)
6. Open the solution
7. Check 'C:\Users\Noli\AppData\Local\Temp\\daijoubu-app_*.designtime.log' and look for the failed tasks (FAILED)
The full source is available on github.
I just followed the instructions but it did not eradicate the warning,
although I ignored it, it does not appear now.
When rebuilding the project, I noticed it takes a long time because it downloads a zipfile on your %userprofile%/AppData/Local/Xamarin/zips/*
-Make sure to not interrupt the build because it will stop downloading and will cause an invalid zip later on, thus reproducing this issue?
Another hypothesis is that I included a component(referenced a dll) and then deleted it, and then re-added it. (as I'm having trouble with intellisense)
Firstly, it's not an 'Error' it's a warning.
Here's what actually happens:
Visual studio/xamarin check for required sdkbuild tools for your project
If you have it already in your SDK then no problem
If not, your project will show above warning in most of project cases.
How to fix this :
Clean your solution
Rebuild it (at this stage visual studio will automatically try to download zips)
If you get Rebuild canceled error, then close visual studio and start again
At this stage it will definitely download required zips.
Again Clean -> Rebuild -> Build -> Close the visual studio and open it again
Or Simplest alternative is
Download all SDKBuild tools available.
Your warning will be gone.
Let me know if it works, coz its worked for me several times.
I too had both Intellisense and compilation issues.
On my Xamarin Forms and Android project, what worked for me is checking out the Resource.Designer.cs file in my Android project, quitting Visual Studio, and then re-opening it.
Hope that helps somebody.
I had this error also. The error was totally my fault, I was adding some strings to my strings.xml file and accidentally left an empty item in there
<string name=""></string>
This broke the R.java file in a really bad way, as the string/resource didn't have a name/id this is how it was created within R.java.
public static final int =0x7f080060;
As you can see it's missing its identifier. The moral of the story is: check all of your XML for any errors.
i had got this warning for 5 days. i applied this suggestion and problem is end.
to install package: 'Xamarin.Android.Support.[BLABLA]'
unzipping has failed:
Please download https://dl-ssl.google.com/android/repository/android_m2repository_r22.zip
in the C:\Users\[UserName]\AppData\Local\Xamarin\Xamarin.Android.Support.Design\23.0.1.3\content directory
Reason: File C:\Users\[UserName]\AppData\Local\Xamarin\zips\96659D653BDE0FAEDB818170891F2BB0.zip is not a ZIP archive
1) Downloading the zip and installing it didn't solve my issues, I got fewer errors, but in general, the messages stayed the same, Please install package [BLABLA], Unzipping failed,...
2) Next I took a look at the zip file they mention in C:\Users\[UserName]\AppData\Local\Xamarin\zips and indeed, 96659D653BDE0FAEDB818170891F2BB0.zip was corrupt. I deleted this zip, did build my project again, and after the build process (this takes a while, leave it 'building': you see your zip reappear and growing to 135MB) all the previous warnings/errors were gone!
Save and close your project.
Go to your path folder.
Move the bin and obj folders from the Android folder to another
location.
Run the project again.
Moving these folders means deleting them and backing them up just in case!
I solved it this way. I hope it helps. :)
I also had this annoying experience, in App2.Droid
"Warning IDE0006 Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled."
... but I seem to have fixed it on my pc.
At certain times when rebuilding my project I also had other errors than the usual ones, telling me
to install package: 'Xamarin.Android.Support.[BLABLA]'
unzipping has failed:
Please download https://dl-ssl.google.com/android/repository/android_m2repository_r22.zip
in the C:\Users[UserName]\AppData\Local\Xamarin\Xamarin.Android.Support.Design\23.0.1.3\content directory
Reason: File C:\Users[UserName]\AppData\Local\Xamarin\zips\96659D653BDE0FAEDB818170891F2BB0.zip is not a ZIP archive
1) Downloading the zip and installing it didn't solve my issues, I got fewer errors, but in general, the messages stayed the same, Please install package [BLABLA], Unzipping failed,...
2) Next I took a look at the zip file they mention in C:\Users[UserName]\AppData\Local\Xamarin\zips and indeed, 96659D653BDE0FAEDB818170891F2BB0.zip was corrupt.
I deleted this zip, did build my project again, and after the build process (this takes a while, leave it 'building': you see your zip reappear and growing to 135MB) all the previous warnings/errors were gone!
It seems manually putting the unzipped files in place didn't work because VS was still trying to unzip the corrupt zip file.
This zip file is unzipped after the first build of the droid project. I remember initially I manually stopped the building of the droid project several times because it was extremely slow and it appeared to hang: probably the first build action tried to download the zip file and unzip it,
canceling (I might have even shot down VS one time) that build that took like forever (I had a terribly slow internet connection that evening) corrupted the zip.
Note:
in C:\Users[UserName]\AppData\Local\Xamarin\zips there are several zip files, my error did tell me the name of the right one.
in C:\Users[UserName]\AppData\Local\Xamarin\Xamarin.Android.Support.Design I had several 23.X folders, one with content in its 'content' subdir, and one without: the 23.0.1.3 one, as specified in the error texts.
Edit: basically what #trycatch answered, his first option is confirmed ;)

Xcode fails in build with "Compilation failed for data model at path" - and does not work with suggested StackOverFlow fixes to similar issues

Hi my Xcode project at some point yesterday started failing to build with the error:
Compilation failed for data model at path
'/Users/cooldocman/Library/Developer/Xcode/DerivedData/cooldocs-ejjarvdamwdcbbcpahhnbweztrmh/Build/Products/Debug-iphonesimulator/cooldocs.app/cooldocs.momd/cooldocs.mom'
I did research on StackOverflow and other sites - and none of the suggested fixes to similar sounding issues have worked for me. The issue appears to be at the intersection of SVN, Xcode, Core Data and XCUserState, and I have tried a number of steps from info I found on StackOverflow and other sites, but still have not solved this.
Here's what I have tried so far:
One stackoverflow article recommended to clean out the SImulator applications folder:
So I removed apps from under /Users/cooldocman/Library/Application Support/iPhone Simulator/5.1/Applications
... the error persisted ...
Another stackoverflow thread advised to remove the temp DerivedData folder.
So I removed all folders under
/Users/cooldocman/Library/Developer/Xcode/DerivedData
(the folders in the error message i.e. /Users/cooldocman/Library/Developer/Xcode/DerivedData/cooldocs-ejjarvdamwdcbbcpahhnbweztrmhwere
therefore were deleted)
Another article said to remove the contents of the Archives folder ...
/Users/cooldocman/Library/Developer/Xcode/Archives
Still no luck even after steps 2 and 3
Even after all the cleanup, I still see when I grep contents of my project that a reference still exists to the old "cooldocs-ejjarvdamwdcbbcpahhnbweztrmh" folder...
$ grep ejjarvdamwdcbbcpahhn //*///*
Binary file trunk/cooldocs.xcodeproj/project.xcworkspace/xcuserdata/cooldocman.xcuserdatad/UserInterfaceState.xcuserstate matches
Now how do I clean this up?
PERHAPS THE SECRET I NEED IS HOW TO CLEAN UP THIS LEFTOVER xcuserdata and hopefully that will resolve the issue - or otherwise, to use a treasure hunt analogy, it may at least open the door to another mysterious tunnel that needs to be crawled down! (and when I come out of that final cave is when I can start the actual work on what I really need to do!)
Thanks for reading and appreciate any help and insights from this group!
:-)
Regarding to xcuserdatad folder, Why not just close your Xcode and delete it in Finder or Terminal? It's safe to do that. Next time you open the project with Xcode, It will recreate it for you .
I had this same issue and none of the suggestions worked. I finally deleted the entire directory which had my project and cloned it again from Github and it fixed the issue. It's possible that some file that was git ignored wasn't getting reverted, but I didn't have time to find out which file it was.

Resources