Build path incomplete only in some workspaces (Android) - android

I have multiple Eclipse (3.52 "Galileo") ) workspaces so that I can keep related projects together in the same workspace. I switch between them with File > Switch Workspace.
I recently copied a good, working project to a different workspace, did a "File > Import" to import it in its new workspace, but after doing a Clean and Build, got the "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 " error.
All my other projects build fine. I thought the "build path" referred to the search path Java or SDK files, so why would it only fail on one project ( ...a project that builds fine in a different workspace, at that)?
I've tried restarting eclipse, switching back and forth between workspaces, doing another clean and build, but no luck. Any ideas? Thanks in advance.

This may be a little late to help you, but in case others are looking, here's how I fixed it:
Right click on your project and select ‘Properties’. Then select ‘Java Build Path’, and the Library tab. Look for a JVM. If one is not there (broken link from your copied project), click ‘Add Library’ and add the default JVM. If a VM is there, select it and hit ‘Edit’ and reselect the default JVM. This should reestablish that link and fix the problem. Hope this helps.

I think Bill LaPrise might be right in most cases, but not in mine. What I eventually had to do was go into the folder where I have all my projects and delete the .metadata for Eclipse (be aware that you'll have to re-import all the projects afterwards! Also all the environment settings you've set would also have to be redone)
After it was deleted I just imported the project again, and it worked.
This was on Eclipse 4.2.0 Juno, if you're wondering.

For those encountering this error while using Maven:
Right click on the project, Build Path -> Configure Build Path...
Select the libraries tab. If Maven dependencies is not in the list,
you have identified the problem.
Close the dialog.
Right click on the project, Maven -> Disable Maven Nature
Right click on the project, Configure -> Convert to Maven Project.

Right click on the project, Maven->Update Project
Will Solve the Problem

Close Eclipse and run the below command from the terminal:
$ mvn clean eclipse:clean eclipse:eclipse

Right click on the project in the Eclipse 'Package Explorer'. Then from the drop down menu find 'Android Tools'. From the sub menu select 'Fix Project Properties'. It works wonders.

restart eclipse works on me. I am on Indigo.

In my case this issue happens after I install ADT manually by downloading .zip instead install from ADT site.
I solve the issue by right click on project -> Java Build Path. You'll see Android XXX, Android Dependencies, Android Private Libraries, Expand and click on Native library location (None), click edit button on right side then add path to ADT folder on eclipse on Location Path. Restart eclipse to complete

Related

Android Studio not recognising Gradle projects

No matter what projects I import they never work - Android Studio is always flagging this is not a Gradle build project.
I select VCS -> GIT and clone the repo without any problem. I then go through the wizard with no issues (I select create project from existing sources), creating my code base with a warning, below. When i try to run throws all sorts of errors.
Migrate Project to Gradle? This project does not use the Gradle build
system. We recommend that you migrate to using the Gradle build
system. More Information about migrating to Gradle.
Don't show this message again.
When I go to the link it makes no sense whatever to me, it says to create an arbitrary Gradle file and populate it with my references (I think), which is out of my understanding. I shouldnt have to do this as it says in the repository instructions that it is in fact a Gradle-based project.
The project I am trying to clone is
https://github.com/googlesamples/android-play-location.git
Can anybody tell me specifically how to import and run the following git repo in Android studio for example?
Ok from the start (as i dont know what other way works)
Go to Git master page (it has 'download to zip' or 'clone to desktop' button). use https://github.com/googlesamples/android-play-location as a test master page if you like to ensure you have no other issues i did not.
Click 'download zip'
Unzip the project
Close the current project in Android Studio -> File/Close Projects
A popup screen like this will appear, choose Import Project (Eclipse ADT, Gradle etc.)
You will be asked to select the project, select your unzipped project within the master folder, eg basicLocation
Select 'create project from existing resources' default
dont change project name (may cause issues)
Next through 'import project -> directories'
Next through project -> libraries
Next Through import projects -> modules and module dependencies
Next through import project ->SDK
Next through import project ->manifest.xmls
Android Studio starts. Ensure the configurations dropdown has a project in it called 'app' app
Select 'sync Gradle' icon (green circle)
May get language warning, ignore or accept restart, doesnt matter
At bottom it should now say 'Gradle executing tasks' after which it will run on device or emulator :)
Short answer: File > Open > the build.gradle file you just cloned with the repo
I just wanted to add this, because I had the same problem, and even if Fearghal´s answer and comments pointed me in the right direction, I think he may have added unnecesary extra steps, i.e. Download as ZIP, Close current project, etc.
Simply put, you VCS > Git Clone, and then open the build.gradle file. That´s it
This can happen for many reasons. I typically see it when I move the directory. The easiest way I have found is to close the project and then reopen it using "Import project (Gradle, Eclipse, ADT, etc.) menu item then selecting the folder. This will force it to reimport the project and fix any metadata/configs.
What worked for me was
On Android Studio
Open the settings.gradle file
include your project
include ':myproject'
Well, as Android Studio correctly says, https://github.com/googlesamples/android-play-location is not a Gradle project.
Any subdirectory of that repository is however.
They are different projects.
So clone that repository and import one of its subdirectory in Gradle.

Eclipse shows error when there are none

My eclipse project suddenly shows the red cross(for error) , but when I expand the project, the red crosses are not visible anywhere.
I have tried building , cleaning, rebuilding, etc, and all that does not seem to work
There is another weird thing that is happening now. When I choose to build automatically, It shows 'building workspace' on an on(in an endless loop.
I am using eclipse Luna, on windows 7.
Is it possible that its a git problem ?
Under problems, I get the error:
"The container 'Android Dependencies' references non existing library 'C:\myproject\bin\myproject.jar'
As mentioned before- usually if you're working on multiple projects at the same time the compiler has to have one of them being the "focused" project. This can be messed up when you have multiple projects opened at the same time.
If you have honestly done "File -> Refresh" and "Project -> Clean" then i recommend closing each project- hover over each project file, right click, "close project" and then restart eclipse.
If this does not work then i would love to see the actual source code- mostly because if the compiler will not run then it may be a workspace placement issue your actual libraries.
Just let me know if this is helpful or not. Good luck!
Some time I am facing this issues. In this case i follow below steps:
Open your work space folder
goto in your project folder
goto bil folder
delete classes folder
Refersh your project from eclipse (select your project and press F5)
its always help for me. I hope it will work for you.
If it is a gradle project, refresh your gradle project.
Right click on your project -> Gradle -> Refresh Gradle Project.
It worked for me.

Yet Another 'The project was not built since its build path is incomplete'

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

Conversion to Dalvik format failed with error 1 :- No solution works

I am adding admob external jar in my project and i am using andengine as a library project but when i try to export the project i get this error. Also adding andengine library project adds andengine.jar also in android dependencies. Is that suppose to happen?
I have tried almost all other answers on stackoverflow but nothing seems to work.
If anyone can help me pls?
Following is my project image
Just solved this problem. I updated my sdk to latest and that solved the problem!
Try exit eclipse, backup if you want, delete gen and bin folders. Start eclipse again, build then export.
This usually happens to me after either eclipse has been running for a long time or after I have build a signed apk successfully. To fix it I just restart eclipse.
In Eclipse, select the project causing the error- go to the menu project -> properties -> java build path -> libraries and remove all jars including the android jars.
Then, right click the project, go to android tools -> fix project properties. Then, add back any other external jars you wanted to add to the build path following the same menu project -> properties -> java build path -> libraries. To ensure there are no errors due to missing libraries.
Then, do a 'clean' on menu project and build again. It should work.

java missing required source folder: 'gen'

I just reformatted my computer. I have windows xp sp3 32 bit.
I install java jdk
android sdk
eclipse ide
When I go to make a new android project i get this error.
Project 'HelloAndroid2' is missing required source folder: 'gen'
Please help i'm new to eclipse so give detail responses.
I just got this problem when I was trying to import a project that was originally created with a version of the SDK that is no longer installed on my machine.
Right click the project. Select Properties. Go to Android. Select a Project Build Target. Click Ok. You might have to clean and rebuild the project as well.
Right-click on the "gen" folder in Eclipse and select Properties. Then, remove the "Derived" checkbox. Then clean the project.
Most likely, there is a problem with one of your resources, preventing R.java from being generated in the gen/ folder. You should have error messages in your Console related to this problem.
Delete the "gen" folder. Then clean the project. Then build the project again. In my case it worked.
try this...
Right click on the project in eclips
Android tools -> Fix project properties
its works for me
ok , here's what worked for me:
delete the project and make sure you are not deleting it from the disk!
import it again and it will solve the problem.
Good luck....
My case was: I imported Zhou Weikan's cocos2d-android and the error emerged. The most straight-forward solution that came to my mind was to create the folder (right-click on the project in Package Explorer -> New -> Folder and then create new folder named 'gen'. It worked in my case.
delete the gen and its content and clean the project again.
Go to project
Right Click
New Folder (Res)
In my case it works Fine
I tried all these things and none of them worked. One day all my projects are running, next day all my projects have an empty gen folder?
After a series of tests to resolve the phantom missing R.java, the one that led me to a drastic action is when I looked at the Properties > Android and the Project Build Target was greyed out and the project wasn't linked to any SDK, almost as if there were no SDKs installed. This was after I uninstalled 4.2 and reinstalled all tools and SDKs...
Long story short, after trying everything I could find online, I just deleted the whole "adt-bundle-mac-x86_64" folder in my workspace folder, unzipped the original download, and dragged the original folder back into the workspace.
This works as a last resort, however you will have to import all of your projects back into the package explorer by New > Project... > Android Project from Existing Code, and make sure you have the "Copy projects into workspace" UNCHECKED.
IMPORTANT: You will find that you can't do this if your "MainActivity" file is always named "MainActivity," so just for future project creating, it's good practice to always name your main activity something different each time.
This error occurred when I tried to graphically add a grid layout. Deleting the grid layout folder fixed the problem for me.
My solution was to install android sdk build tools with Android SDK Manager.
The probkem was that whenever I clean the project, the gen directory becomes empty.
Hope it will help!
if gen folder or R.java file is not generated then first check error in XML file and make sure android menifest.xml is present.
Right click on the project> Properties> Android > use the latest API
takes care of everything!
In my case, the solution was downgrading the target from android-22 to android-19 at project.properties

Categories

Resources