R.Java went missing in all projects - java

I was working around with my Project when I noticed appcompat_v7. I didn't know what exactly that was, so I just deleted it. And now, none of my projects are generating R.java, even after cleaning and rebuilding. Did everything which I could find on the net, but all in vein.
I managed to get back appcompat_v7 by making a new project, but even that wasn't generating R.java. I've messed it all up now, what to do next? How to get back R.java?

Strange fix but this workes
Right-click on the "appcompat_v7" project and go to -> Properties -> Android.
Your target build should already be set at the latest build (in my case Android 5.0.1). Click any other android package (apart from its current target) and click "Apply". Click "Ok" to close the box.
Re-open the Properties box by the same method but this time check the latest build (in my case Android 5.0.1) as the Project Build Target. Click "Apply", then "Ok" to close the box.
Clean the appcompat_v7 project. You'll probably need to clean/build all other projects that reference this library.
This solved it for me.

Related

The project cannot be built until build path errors are resolved [duplicate]

While compiling an android project in eclipse 3.4.2, I am getting The project cannot be built until the build path errors are resolved.
I got a temporary solution from the blog http://www.scottdstrader.com/blog/ether_archives/000921.html
The resolution was to force a resave of the selected projects (and their .classpath files):
Open the project properties
Select Java Build Path > Libraries
Add a new, arbitrary library (to be deleted later) > OK
Wait for the workspace to refresh (or force a refresh of the project)
The error(s) will go away
Remove the dummy library
The only other references I could find were to make minor alterations of contents of the .classpath file.
Is there any permanent fix for this issue?
Have you tried using Project > Clean... from the menu? This will force a new build on the selected projects in Eclipse.
1-Right CLick on your project folder, Choose Build Path > Configure Build Path
2-Select Libraries Tab and delete any arbitrary library present there.
3-Click on Add Library option, Select JRE System Library and click Next.
4-Choose last Radiobutton option Workspace default JRE and click Finish.
5-press f5 for refresh.
6-run ur program .
This what fixed it for me...
I was having an issue with my spring-core.jar.
I deleted the entire release directory located here. (I'm on win 10).
C:\Users********.m2\repository\org\springframework\spring-core\4.3.1.RELEASE
I right clicked on the project > Maven > Update project and my exclamation mark disappeared. No problems any more.
Here is the source where I found the information:
http://crunchify.com/cannot-be-read-or-is-not-a-valid-zip-file-how-to-fix-maven-build-path-error-with-corrupted-jar-file/
This happens when libraries added to the project doesn't have the correct path.
Right click on your project (from package explorer)
Got build path -> configure build path
Select the libraries tab
Fix the path error (give the correct path) by editing jars or classes at fault
This works for me: close the project then re-open it, this will force eclipse to reload a fresh project and detects the correct build path.
None of the other answers worked for me. Even after fixing my build path issues, doing a refresh, clean, rebuild, and restart (of both eclipse and the computer), I was still getting the little red exclamation point.
I fixed it by closing the project (right-click, close project) and reopening it (double-click the closed project), which seemed to force eclipse to "notice" that the build path problems had been corrected.
For my mac osx Eclipse, I followed following steps:
Right CLick on your project, Choose Build Path > Configure Build Path
Select Libraries Tab and delete any arbitrary library or anything else causing errors in Build Path.
Click on Add Library button, Select JRE System Library and click Next.
Choose last Radiobutton option Workspace default JRE and click Finish.
Clean and build your project.
get a cmd and run
mvn eclipse:eclipse
This is what worked for me:
Go to ~/.m2/repository and deleted everything there by running rm
-rf. Make sure everything is deleted.
Re-launch eclipse or STS
Right click on project -> Maven -> update project.
On my Mac this is what worked for me
Project > Clean (errors and warnings will remain or increase after this)
Close Eclipse
Reopen Eclipse (errors show momentarily and then disappear, warnings remain)
You are good to go and can now run your project
I've seen this problem a few times (got it again right now on my home computer with Eclipse 4.2).
Forcing a resave (by changing the classpath e.g. by adding a library, save, change-back) works temporarily. But the problem comes back when Eclipse is restarted :(
Nuking the Eclipse workspace from orbit will permanently fix it (until next time). But there must be a better way!
just check if any unnecessary Jars are added in your library or not. if yes, then simply remove that jars from your library and clean your project once. Its worked for me.
In Eclipse this worked for me: right click project. -> Properties -> Library Section; Add (any library at all) -> select library and click remove -> press okay.
I ran into this annoying issue with the Play framework. It would be nice if there was some way of knowing what build errors Eclipse is unhappy about, but it's not going to tell you. With one project, I was able to close the project, rebuild the Eclipse configuration with sbt eclipse, and reopen. With an almost identical project, that didn't work. But deleting the project, rebuilding the Eclipse configuration with sbt eclipse, and importing, did the trick.
If you think you've done everything correctly but Eclipse still complains about the jars, refresh the folder where the jars are and make sure eclipse knows they've been added to the project. Specifying the file path alone is (apparently) not enough
I've faced this issue a couple of times and following the below steps has resolved both the times.
1. Navigate to C:\Users\
2. locate the ".m2" folder and delete it.
Now navigate to the particular project in eclipse and Right-click on the project > Maven > Update Project
wait until the project is updated and in my case following the above steps resolved both the times.
I was getting an additional warning
The compiler compliance specified is 1.6 but a JRE 1.8 is used
Resolving this warning make the error also go away. The steps are as follows:
I right-clicked on it, then clicked on Quick Fix. From the dialog that opened I selected Open the Compiler Compliance property page, and clicked the Finish button.
(This is same as Java Compiler section.)
In this dialog I found the Compiler compliance level drop down and changed 1.6 to 1.8, and clicked on Apply and close.
I got a message box Compiler Settings Changed which asked if I wanted to Build the project now?. I clicked on Yes.
The build path error went away.
Go to > Right CLick on your project folder > Build Path > Configure Build Path > Libraries Tab > remove project and external dependencies > apply & close
Now, Gradle refresh your project.
Added below to pom.xml file and it worked eventually:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.0</version>
<scope>provided</scope>
</dependency>
Goto to Project=>Build Automatically . Make sure it is ticked

Eclipse Luna - Project is not showing up - Strange

I just installed Luna. I imported 3 projects all went well for a while.
Then I restarted eclipse and now it shows only two projects. I tried to import the missing project, but it says it already exists in the workspace.
I closed all other projects and pressed Ctrl+Shift+T to see if it still shows up the types from that invisible project. Yes, it shows files from that invisible project. I opened one of the files and selected Show In Project Explorer. Nothing happens.
Also, in the code when I press . after an String object, nothing shows up.
Seems to be strange. Any help?
Also, if I can do fresh import of all projects, that would help too. But again, I don't know why context assist is not working. I can try importing everything afresh. For this, what are all the eclipse related folders / files I need to remove?
Edit
this helped me with workingset / missing projects. But when I press . after an object, nothing comes up.
For others benefit, it has to do with Working sets. You can click Down arrow in Project Explorer and select "Edit Active Working Set". In the window, on the left hand side, you can see your non-visible projects and move it to right hand side to make them show up under active working set. HTH.
Regarding the problem where Eclipse says it "already exists in the workspace": I recently had a similar problem and I fixed it by unchecking the box that says "copy projects into workspace" and then hit refresh and it should work.
Just fixed this issue by clicking 'Deselect working set' ( under dropdown in project explorer ). For me, 'edit Active working set' was disabled to start with.
It sounds like the projects exists on the file system in the workspace directory, but the actual project got deleted or never imported in the eclipse workspace. Take a look at the workspace directory, all three projects should be there. You can delete the "missing" project from the file system and reimport it again.

R.java disappeared after adding new png pics in my hdpi folder

I'm using eclips with the android sdk plug-in, my project was working normally with no errors at all and it was a very clean project, but when i deleted and added pictures (PNG pics) to my hdpi folder, plus i also deleted the ic_launcher, but renamed my new icon as "ic_launcher, but R.java was not generated, I and renamed all the pics in lower case without spaces, and than cleaned the project and made sure every link in xml is correctly renamed, so is there any way to regenerate the R.Java ?
A couple of things to do here;
Check if Project --> Build automatically is on
Refresh your layout folder through the right-click action
Clean all your projects etc
If 2. didn't work, restart Eclipse
While doing all this, keep an eye on your console view, it will report errors if you named some resource invalid.
Apart from Project=>Clean, i would like to suggest you to check Windows => Show View => Error log. It may help you. Android Pre compiler shows error there.
just reload your project, maybe it helps (close and reopen eclipse)

Can't Export Android Application in Eclipse

I'm experiencing some strange behavior in Eclipse. I'm trying to export my Android application, which is a game that is written using AndEngine, the open source game engine. Not sure if that is relevant.
Anyway, there are no errors in my project or the library dependencies of Android. I have been running the application on my phone with the debug build for ages. Now I want to export a signed application, and it won't work! (It did used to).
I right click my project, click Android Tools > Export Signed Application and right when I do that, two errors show up that say,
No .class files were found in project "AndEngine" so none of the classfile basechecks could be run . Does the project need to be built first?
No .class files were found in project "AndEnginePhysicsBox2DExtension" so none of the classfile basechecks could be run . Does the project need to be built first?
How the heck do I fix this? I have done a Project > Clean, open and closed Eclipse, open and closed the individual projects. And again - this error is NOT there until I go to export the app! What the heck!
Ok I think I figured this out. Not sure of the "real" issue, but my workaround for the time being is to right click my project in the file tree on the left, then click Properties. I selected the "Android Lint Preferences" in the dialog that comes up, and just hit "Ignore All". Now I can build without the error.
While this is a work around, I'm not thrilled about leaving that disabled completely. I'd like to know which Lint preference i can specifically disable. (I, quite frankly, don't even know what lint is)
I solve this problem turning off Build Automatically in Eclipse before export.
Are those projects set as libraries?
Open Project -> Properties.
Click Android on the left.
Scroll down and make sure under Libraries that "Is Library" is checked.
probably just add:
<issue id="LintError" severity="ignore" />
to your lint.xml config file.
In eclipse probably just set this one (LintError) error to ignore.

Eclipse says my Android project(s) contain(s) errors, but there aren't any

Since last night, Eclipse hasn't been letting me run any of my projects and gives me the error "Your project contains error(s), please fix it before running it".
This happens regardless of which project I use.
There are no code errors in any projects
There are no missing files (R.java, etc.) or folders (src, res, etc.)
There are no errors in the console (even on verbose) or the error log screen
I've cleaned all the projects, and each individual project many times
I've restarted ADB, Eclipse, and my computer
I have no idea what to do next, so hopefully its fixable.
NOTE: I am using Git, and this occurred after switching to my master branch to export a new update to one of my apps.
Thank you in advance! (:
Edit 1: I have also tried deleting and re-importing the projects before I posted this.
Click Window -> Show View -> Problems, that should show what exactly Eclipse thinks is wrong with your project. Sometimes you can simply delete the problem from that view, and Eclipse believes you everything is fine (yep, weird, I know).
Also, after you switch branches using an external source control tool (one not integrated into Eclipse through a plugin), Eclipse sometimes won't pick up all changes, you'd need to manually refresh the whole project file tree.
If nothing else helps, try setting up a new Eclipse workspace and importing your project there.
check your build paths - there could be jars and dependencies that are outside of the app that need to be opened or imported.
another trick is to edit an xml file, just change one word to intentionally cause an error, save the file, then change it back to proper syntax and save again. Error magically disappears.
another trick is to edit a java file, (cause error, save, fix error, magically error free)
I had this problem and I have fixed it. My issue was this:
I somehow managed to require another project in my build. That project had errors in it, which I believe is what caused the issue. I think this happened when I accidentally asked Eclipse to fix my build path or something when I was trying to fix a mistake. To correct this issue go to (on mac):
Right click on your project folder in the Package Explorer
In the menu, go to "Build Path"
Select "Configure Build Path"
Go to the "Projects" tab (along the top).
Is there anything in there? If there is and you weren't expecting there to be, select the project that is in that folder and hit "Remove"
This fixed the issue for me. Hope it helps.
I think you need to clean your project. Do project -> clean. Should work fine after that.
Try using Project->Android Tools->Fix Project Properties besides checking for your Android path. Check if your ANDROID_HOME and ANDROID_SDK are set correctly besides adding tools and platform-tools are set correctly in environment variable PATH.
Hope this helps!
Go to your .android folder and delete your debug certificate.
E:\Users\(your profile)\.android
Inside that folder there is a file name 'debug.keystore'. Delete that, clean and try to build the project again. Sometimes this error is caused when the certificate expires.
I found this answer here and it solved my problem ;-)
I think go to project ->clean some error can be solve this problem
Go to Projects in the menu bar
Then check the menu Build Automatically.
This helped for me.

Categories

Resources