I have a work space with many projects. One of them is suddenly missing the Google APIs libraries even though it is clearly checked. the properties file lists it correctly.
How do I get Eclipse to add these to this one project?
once i had problem like this : i tried many but can't find and positive solution.(1)
- make new project with required target and move src, res, ref and manifest to this new project.(2)- Just try remove auto build option from project menu and then delete gen folder and just build project and then clean & build project.
This often works for me:
Select another build target and click 'Apply'. When the update is finished I select the previous build target and then 'Apply' again.
Remove 'bin' and 'gen' directories from my project and select the clean option in the project menu.
Related
I am working with andengine and I am stuck at a point, I have a project running to other system, I have new installation.
I am unable to figure out, I have imported project , in settings i have selected AndEngine as external Libraries, but still, No Auto resolve suggestion by compiler/IDE to add the reference,
Below I am attaching screen shot
Right click your project
Project Properties
Java Compiler
Compiler Compliance -> 1.6 (Source: Nicolas Gramlich, the guy who made AndEngine)
Create gen and res folder if missing (if there is already, and it still say missing, then delete and recreate it).
Right-click the project -> Properties -> Android, choose Android 4.0 if there is no target selected. Delete all library reference and add its manually again.
And always clean and build your project when you add images or change things.
Good luck!
I have an Android project that I've been happily building for weeks in Eclipse Indigo. I have not changed any settings, libraries, or workspace components, or added or removed any files. A few hours ago I was doing a "Run as" to run my app on a phone and Eclipse did a hard hang. I couldn't even kill it in Task Manager so I rebooted my PC.
Now when I try to build my app I get
"The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project"
I deleted gen and did a clean and build with the same result. In the project Properties for the build path, in the Libraries tab it shows
Android Dependencies
Android Private Libraries
Unable to get system library for the project.
Any idea what's going on? This Eclipse "build path is incomplete" error is very common but when I search Stack Overflow and Google, most of the cases seem to be related to importing new projects, moving workspaces, changing libraries or other things I didn't do.
Thanks in advance!
I fixed my problem.
I did a File>Switch Workspace and switched to another workspace that had a different project in it. Then I switched back to my original workspace and everything was fine.
So we can add this to the very long list of folk-remedies, nostrums, old-wives-tales, superstitions and other bits of software lore that accompany the various weird bugs that afflict Eclipse. I sure hope Android Studio turns out to be better than this!
This worked for me:
Open project properties > Java Build Path > Libraries.
Select "Unable to get system library..." > Remove > OK.
Open Libraries again > Add Library > "Android Classpath Container" > Next > Finish > OK.
The following worked for me, so I thought I would share.
Restarted Eclipse and ran into the same problem.
Did the following to get my project to build again.
Right click on project inside Package Explorer and Select properties.
Go to Java Build Path.
Click on Libraries TAB
Remove the line that says "Unable to get system library for the project"
select ok.
Then right click on project, and select "Android Tools" -> "Fix Project Properties."
Hope this helps.... eclipse can be a real PITA sometimes.
BTW I "watched" for any changes after the delete and fix, and it looks like
Is removed from .classpath, and then the "Fix Project Properties" adds the line right back.
Clean + Build works after that.
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
Try Project-->Clean. Also make sure "Build Automatically" is checked
I'm getting errors everywhere that say: cannot be resolved or is not a field to all my R.something.
I'm guessing the R file isn't properly generated and from what I've read it's a problem in the res folder but I cant find it; I deleted the last layout I made but the problem persists.
No layout actually has any errors to be shown (they all build successfully).
Can anyone help me with this bug?
I found this happening to me with a broken layout. No need to be worry. I am trying my best to giving you the solution
Solution
Make sure that anything the R. links to is not broken. Fix all errors in your XML files. If anything in the ADKs are broken, R will not regenerate.
If you somehow hit something and created import android.R in your activity, remove it.
Run Project -> Clean. This will delete and regenerate R and BuildConfig.
Make sure Project -> Build Automatically is ticked. If not, build it manually via Menu -> Project -> Build Project .
Wait a few seconds for the errors to disappear.
If it doesn't work, delete everything inside the /gen/ folder
If it still doesn't work, try right-clicking your project -> Android Tools -> Fix Project Properties.
Check your *.properties files (in the root folder of your app folder) and make sure that the links in there are not broken.
Right-click your project > properties > Android.
Look at the Project Build Target and Library sections on the right side of the page. Your Build Target should match the target in your AndroidManifest.xml. So if it's set to target 17 in AndroidManifest, make sure that the Target Name is Android 4.2. If your Library has an X under the reference, remove and re-add the library until there's a green tick. This might happen if you've moved a few files and folders around.
What to do if R doesn't regenerate
This usually happens when you have a broken xml file.
Check errors inside your XML files, mainly within the /res/ folder
Common places are /layout/ and /values/ especially if you've changed one of them recently
Check AndroidManifest.xml, I find that often I change a string, and forget to change the string name from AndroidManifest.xml.
Check that Android SDK Build-tools is installed. Window->Android SDK Manager->Tools->Android SDK Build-tools
Make sure when you update the Android SDK Tools, you also update the Android SDK Platform-tools and Android ASK Build-tools. Build fails silently if they don't match.
If you can't find the issue, right click /gen/ -> Restore from local history... -> tick R.java -> click Restore. This doesn't solve the problem, but it will clear out the extra errors to make the problem easier to find.
Hope it will help you. :)
One (or multiple) xml resources must be broken in your project. Check out "Problems" view in Eclipse (Window - Show view - Problems) and fix all issues there. Then rebuild your project (Project - Clean).
Sometimes, just restarting Eclipse can fix the problems.
Some steps you can try:
Right click project -> Android Tools -> Fix Project Properties
Right click project -> Refresh
Right click project -> Properties -> Java Build Path -> Check everything that's unchecked in 'Order and Export'
Project -> Clean...
Restart Eclipse
Might solve your problems!
EDIT: Also make sure there are no caps in your XML files.
I'm working on a team project. I included a .jar file in Build Path and committed to SVN. When I updated code in my working directory, a new folder appears in Eclipse called "Android Dependencies". If I let it be there, my program runs; If I remove it, my program reports a ClassNotFoundException.
Now how to fix this ClassNotFoundException?
For the people whose heart dropped when they read the comment that deleting the Android Dependencies virtual folder will destroy your project, there is an easy fix.
Right click on the destroyed project
Select "Android Tools > Fix Project Properties" in the dropdown
I hosed my project dependencies when trying to set up my git repo, and this is fixed it.
Android Dependencies is a virtual folder where Eclipse shows what JAR files the project depends on. It's not a physical folder; you won't find it on your hard disk. And the folder is not checked in into Subversion.
Do not delete that folder. You will destroy your project.
To fix it, just revert to an older Subversion revision and check it in again.
I've had a similar problem after setting up a git repo with my project.
The problem was that the appcompat import lost its folder reference.
If the 'Fix Project Properties' mentioned doesn't work for you try this:
Go to Project > Properties
Go to the 'Android' tab
Under 'Libraries', if there's a red 'X' next to the appcompat folder, remove
it then hit 'add' and add it in again. The reference should show a
green tick now.
Save and clean the project if needs be
If you also have marked project build target below API level 16 in the Android project properties, the error is going to come because prior to this level, there was no Android dependencies.
I created a Hello world app but get this strange error:
The project cannot be built until the build path errors are resolved
I haven't changed the project, jut created it and tried to run it.
to avoid that annoying problem i have 3 solutions that worked for me.
Solution 1)
delete your generated R.java file
inside your gen/ folder
Solution 2)
a)Delete your project from Eclipse
(i said ONLY from Eclipse, uncheck option: Delete project
contents on disk)
b) import your project to Eclipse:
file > Import > Existing Projects into
Workspace (Look for your project
previously deleted from Eclipse) >
Finish.
Solution 3)
make Solution 1 then Solution 2
It is either a spurious message you can solve by forcing Eclipse to recompute its library paths
I found the resolution for this at Scott D. Strader's blog.
To summarize the solution I only needed to add a library to my project and then remove it to force Eclipse to perform the necessary actions to resolve the problem. I would post the detailed steps here but I don't want to steal his content.
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
Note: as the OP mentions, a simple restart of the IDE can be enough.
Or you actually miss one critical library like a JRE library:
I needed to add the JRE library to the project for it to run. Not sure if this was due to the updated version or something elseā¦. Any way this fixed the issue:
Project > Properties
Java Build Path
Libraries tab
Click add library
Select JRE System Library
Next
Finish
Sounds like you are missing an import or a jar. In your project in the project explorer there should be a red x on the file icon that contains the error.
In addition to the listed answers, there is one other scenario I've seen this error appear when using the sample projects included with the Android SDK. For some reason, the generated R.java file can be invalid or corrupt. You can get around it by expanding the "gen" folder in the Package Explorer and deleting the R.java file. It will immediately get regenerated and the error goes away.
Right click on your project, choose "Build Path", "Configure Build Path" -> and choose Android 2.2, or that target you specified when you created your project
I have had similar issues. for me simply closing the emulator and re-running the project works