Android: eclipse workspace takes a long time to build? - android

My eclipse workspace has just one android project in it and is set to "build automatically". Every time I make a change to some code, and save the change, the workspace builds. Initially this is fine, but at some point the builds start to take about 5 seconds for every change. At this point, I create a new workspace and import the project, and everything works great for a while (days or weeks), but inevitably it slows down again. Has anyone else experienced this and/or have a solution?

You can try in Eclipse:
Window - > Preferences - > Android -> Build -> Skip packaging and dexing export or launch.(Speeds up automatic builds on file save)
And
UnMark : Project - > Build Automatically
And you can also complete with :
Window - > Preferences - > General -> Workspace - > Linked Resource - Enable linked resource (unmark) try only if your project not have resources from other project.
For me stoped building slow process after every save.

Under top menu item Project->Build Automatically
uncheck the option, then you'll have to build project manually before testing, just select Project->Build Project then Run after build completes.

Increasing Xms and Xmx parameters in eclipse.ini worked for me:
Original values:
-Xms40m
-Xmx768m
New values:
-Xms256m
-Xmx1024m

Does it help if you clean your project (menu 'project'-> clean) and does that help?
This might be something that's a part of the slowness, although it doesn't explain why it's quick after a new import, and then slows down: Android compilation is slow (using Eclipse)

Removing the device from USB & then re-connect.

Related

Android Studio 0.8.6 does NOT automatically sync with gradle files

I don't know what I have done or what has happened. But my project has suddenly stopped to sync my project with the gradle files. So every time I run the app my changes aren't there. I have to go to Tools > Android > Sync project with gradle files before every time I run the app. I didn't need to before.
Any ideas of how I can fix this?
EDIT: I've done the usual stuff like rebuild and clean the project. without any change.
And for people who just vote close please specify why somewhere so the person you vote on can either improve the question or at least understand why it should be closed!
You can always try to "Open Project" from quick start instead of recently open (point at actual build.gradle instead of directory) and choose "Delete Existing Project and Import"
Check in preferences that you did not by any accident un-checked "Synchronize files on frame activation" in Preferences > IDE Settings > General > Synchronization
Have you tried invalidating your caches..File -> Invalidate Cache / Restart

android eclipse unable to execute dex java heap space error

I am so tired of this java heap space error on my eclipse whenever I build my android application.
I add 9 libraries to my android application. (Right click on project name -> Properties -> Android -> Add library).
In some forums, I find people asking to make changes in eclipse.ini file and some saying to add user library and add jars to it. And add user library to my app.
I have changed my MaxPermSize to 1024 in eclipse.ini. It didnt help
When I add user library to my app, my app is not able to recognise app_compat_v7.jar. It throws error on styles file where I use Theme.Appcompat.Light
May I know where I am going wrong ? Any help will be appreciated.
Try the following:
Right click your project. Go to Properties -> Java Build Path -> Order and Export.
And
Uncheck the check box against your included library. Press OK and run the project.
On doing this Eclipse will take only the classes which are needed in the code, from the jar instead of storing all the classes from the jar.
And also see this question.
Second Technique
Modify the -XmsAm and -XmxBm paremeters in eclipse.ini so that they are large enough. The default is -Xms40m -Xmx384m. Try changing them both to -Xms512m -Xmx512m and restart eclipse to see if that helps. If not, continue to increase the values and restart eclipse until either one of two things happens:
Your build completes.
Eclipse won't restart because you don't have enough memory.
eclipse.ini is located at /etc/eclipse.ini in Ubuntu (assuming you installed Eclipse from the Ubuntu repositories).
For MAC please see:
Finding eclipse.ini is a wee bit tricky. To locate it, right-click on the Eclipse Application icon and select "Show Package Contents", then double-click on the "Contents" folder and then double-click on the "MacOS" folder, the home of eclipse.ini

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

Clean in Eclipse temporarily destroys Android project with error message: missing required source folder: 'gen'

I am experiencing an annoying problem with an Android project in Eclipse. All my other Android projects are okey (at the moment). Whenever I perform a clean (Menu:Project->Clean...) the project gives an error and I can't compile/run the app. The error is:
Project 'Project Name' is missing required source folder: 'gen'
As soon as I edit some code the problem disappears until I perform a clean again. I can also right-click on the gen-folder and delete it. Eclipse will recreate the gen-folder and the problem disappears until I perform a clean. This is not a showstopper but it is really annoying since I sometimes have to do a clean before I run the app.
I'm using the following:
OS: Ubuntu 10.04 (Linux CYLON 2.6.32-24-generic)
Eclipse: Helios Release (Build id: 20100617-1415)
Android dev tools: 0.9.7.v201005071157-36220 (the latest as of today)
We have finally tracked the last problem regarding this bug.
The "clean" action used to always delete the "gen" folder which was wrong.
This was fixed in ADT 8 or 9, I can't remember.
However, if the "gen" folder is marked as derived it still gets deleted which leads to the error.
When the "New Project Wizard" is run, the gen folder is created normally, without the "derived" flag, so this is fine.
The following scenario however is broken:
delete manually gen, or
check in the source code in a repository (git/svn/...) and don't put the "gen" folder in there, then do a check out on another computer.
This leads to ADT recreating automatically the "gen" folder during build, this time enabling the "derived" flag, which will trigger the wrong behavior on "clean".
The temporary solution is to:
right click "gen"
choose "Properties"
uncheck "Derived"
as long as the "gen" folder doesn't get deleted you'll be able to clean your project without side effect.
I just checked in a fix to:
- never mark the folder as "derived"
- during clean, first remove the "derived" flag from "gen" so that it doesn't get deleted in the case of older projects.
Patch is visible at: https://review.source.android.com/#change,22410
I had the same problem, and there is how I solve it:
Disable "Build Automatically"
Clean the project
Create the "gen" folder manually by "New -> Folder"
Re-enable "Build Automatically" as need
It is not a showstopper but it is so painful and annoying if you have several people working on the same project and you cannot check in the IDE settings into source depot, and you have Ant build script and IDE based build system setup for whatever reason.
It is not a showstopper since you can manually do this do that every other time, but this is just (a) workaround(s). It is painful as many of us have to carefully check logcat/console/navigator/project_setting to make sure there is no other "real" problem present each time it occurs.
I suspect the root cause is the timing issue to validate the "gen" existence, the second is the revalidate the "build path error" condition. The "gen" folder, no matter is marked as derived or not, can be recreated; once it exists, the "build path error" condition should be updated. The second suspection is there is a dead lock for these two condition flags somehow.
Hope you can dig into this issue and fix it eveually.
AFAIK, If Everything is Perfect you have know need to touch or delete the gen Folder.
As soon as I edit some code the problem disappears until I perform a clean again.
What are the things you have changed in your code. Mainly about the Resources. It makes the difference upto my knowledge. dont see only the Logcat and Consider the Console window also shows some error in the red color. First clear that errors and then clean and build your project.
Edit:
Check for:
Is there Android Package is Missing?
Right Click--> Properties--> Java Build Path--> Order and Suppport Tab--> Check res or src folders are selected?

Eclipse - HelloWorld - Android error?

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

Categories

Resources