Why does Android Eclipse constantly refresh external folders and take forver? - android

Just my a new Android phone and I've been tinkering with some basic apps. It's been driving my crazy that the Android plugin for Eclipse refreshes externals folders whenever I save ANYTHING. Normally I wouldn't mind but when it takes 10s to refresh I start to notice.
I already searched and other people have this problem, but there are no solutions.
If it matters, Eclipse 3.5 running on a 64bit jvm on Ubuntu 9.10

If you have references to external sources put them in a zip file:
YourProject->rightClick->Properties->Java Build Path->libraries->..., and then most notably android.jar, but other libs can be the culprit too. Expand it and and select Source attachment, and then (if it doesn't say 'None') press the 'Edit...'-button. If that points to a directory waht you should do is compress that source-directory into a zip file and make the source attachment point to that file.
Apparently eclipse/adt feels the need to refresh sources on the file-system. When they're in a zip-file it seems confident that they have not changed....

You could try disabling "Build automatically" from the Project menu.

First of all Eclipse has a cool feature called a Preferences menu which is located under the window menu located at the top of the screen. Inside there are all sorts settings for pretty much anything you could want to adjust, including the option to turn off Native file system hooks and polling (under General -> Workspace). This is the actual solution to your problem as disabling build automatically doesn't solve the external folders issue, as soon as you build your project it starts right back up with refreshing them. Just keep in mind that if you update your Android SDK at all you will probably need to right click on the root directory of your project and hit refresh after the update finishes.
Secondly, as far as Netbeans is concerned there are at least a half a dozen pages worth of forums posts and various methods for using the Android SDK with it that are also available through Google, I'd give it a look.

I generally do the above step of turning off Automatic build and also try to have not more then 1 open project in my project list.
I myself am fed up of Eclipse from this. Importing a big android project 'ALWAYS' hangs my eclipse and i have to force close it and restart it.
P.S. I really wish google would create an Android plugin for Netbeans =(

Related

How to refresh A Project in Eclipse

I have been studying Android on Eclipse Mars for some time and i have been facing a constant problem everyday-the changes made in a folder/file are not recognized by some other folder/file. For example, if i create a new layout in the layout folder and then use it in the setContentView, it shows me an error ("layout-name cannot be resolved or is not a field). It works if i save the project,close it, and open it again, but this takes up a lot of time if i have more than one error, so the question-is there a way to save and refresh the project (without having to close it) so that the newly made files and folders are recognized by the java files?
Thank you.
You can refresh your project in Eclipse by right clicking on the project root folder in your Project Explorer and selecting "Refresh".
You may also want to consider checking if you have "auto build project" turned on. In your top toolbar go to Project -> Build Automatically.
If build automatically is turned off you will have to manually build your project, by Right Clicking on the project in your Project Explorer and selecting "Build Project".
However, I do agree with Pankaj Nimgade that Android Studio is likely a better entry point IDE for Android development.
Real advice: Switch to Android Studio as soon as you can. There you would sometimes have another problem called "sync" though. But it's a much better IDE and you are at least in line with Google.
on Eclipse, F5 should do the trick. Or right click your project and Refresh. Or Clean all projects. If you are still stuck, simply close Eclipse and run it again.

Android Studio not reflecting changes to images during export of APK

I have a project i have worked on for a few weeks now. I went in to optimize some png's and was able to take a few mb's off the file size. However, when i generate the apk its the exact same file size.
I remember in eclipse i could go into the gen folder to delete those images and it would then recognize the new ones. I tried to go into the build folder in studio and do that but it still produces an apk the same file size. Is there something im missing?
I have taken one of the optimized images out of the produced apk and compared to the old and its the same size so its not picking up the new one for whatever reason.
Is there something else im supposed to do?
I know this is a very old thread but the answer to this question was never accepted.
So the problem here is in the emulator and not your computer or the software.
When you update the images the file names and paths stay the same. So it doesn't change the files on the emulator. I think it's just the way the android system works, if nothing changes then the app on the phone doesn't update.
So the solution is to simply uninstall the app from your emulator, then run the app from Android Studio.
Try rebuilding your app after refreshing the workspace, it works in eclipse but not sure about studio.
Go to Project->Clean. Uncheck "Start a build immediately". Go right click on your project and choose build. Then Run as - Android Application.
In IntellijIdea :
http://www.jetbrains.com/idea/webhelp/cleaning-system-cache.html
How to clean project cache in Intellij idea like Eclipse's clean?
For me it works to choose Build -> Rebuild Project on the main menu to do a full rebuild whenever I only change assets (i.e. when no source code has changed).
On top panel of xml designer there is Refresh Button.

android eclipse driving me mad?

I've quite new to Android development and specially Eclipse.
I'm busy on a project called, say 'HelloEclipse'. I've had some major changes ahead, in which I had to some very big changes.
So I made a zip file of c:\workspace\HelloEclipse, placed that in a save place. Went on to work on my project. Few hours later, I wanted to go back to the saved situation. Closed Ecplise, rebooted my computer, because I wanted to make sure there were no locked files. Deleted the old c:\workspace\HelloEclipse folder, place the version out of the ZIP file back.
This resulted in a totally corrupted workspace status. Could not go foward, nor backward. I've ended up, creating a new project, and pasted in everything, took me hours. I think this is quite stupid Eclipse behavior. I've also tried ot, export/import with a archive from out of Eclipse, also not succesfull.
So the two questions;
How am I suppose to save projects (without installing anything like subversion)?
Why is saving the files not enough, and why does that make Eclipse barf?
Thanks in advance!
Dennis
In eclipse if you want to reimport an old project from a ZIP, don't just copy the project files to the workspace, instead, extract the files to a normal dir outside the workspace.
Open Eclipse normally and select File>New Project>Android Project, just as you would to to create a new Android project, but then in the new android project window, you have a radio button giving you the choice to Create project from existing source, point it to the directory where you have extracted your old project and it should be re-imported to the WorkSpace alright.
Or do File>Import>Import existing project into workspace.
But in any case, don't put the files in the workspace manually to avoid conflicts, Eclipse will copy the files it needs itself upon importing.
There are hidden workspace files that you may have missed -- specifically, .classpath and .project. That said, it's a lot easier to make a backup copy (for example, of a released version so you can continue developing while supporting the release) by simply right-clicking on the top-level of the project in Eclipse and selecting Copy, then right-clicking and selecting Paste. The result will be a copy of the project after an opportunity to name the copy.
If you want to zip projects, you can do that by exporting them. If you want to delete existing projects, you should do that from inside Eclipse with a right-click. You can import the zip you previously exported.
If by save, you meant backing up the best something would be to create a local repository. If I were you, I would backup my code in an online repository too; to save it from hardware crashes or other disasters.
In your problem, you could have tried deleting the project alone and import the backup copy(from the zipped file) instead of deleting the entire workspace. Can't pinpoint the exact reason of why eclipse barfed but maybe because it messed up the workspace settings for eclipse. On a related note, I found this on the net.
Eclipse is rather troublesome at times but AFAIK it's the best IDE for android.
First of all, after several months of developing with eclipse I moved to IntelliJ (they have a community edition) and I found it much much better.
In intelliJ you can save local history, for example, you can set-up a label and go back to that label whenever you like without losing anything.
As for eclipse, you probably didn't zip some hidden files or something.
In addition, I remember having some similar problem, I had to resync the files with the project, try this one
Good Luck
I do the same thing with my projects. Instead of going through windows explorer to copy the files, I find copying the entire project from within Eclipse (right click the project in the explorer window pane, click copy, then click outside of the project and click paste) works just fine. When you paste it, you can specify a new save location and project name, which can be your backup space. Then you can switch between versions of the project no problem.

Eclipse - Android Library Update

Related to the question here, is the Android Library Update step necessary and, if not, can it be removed from the startup and/or build process? A manual update seems like an appropriate option, especially if it improves build times and you already have a previous clean compile.
You can disable Android Development Toolkit from General -> Startup and Shutdown.
this may not exactly answer your question, but if you do have a lot of projects it will rebuilt all of it when you open eclipse. what i do myself is i "close" the projects that I'm not working on and I find it more tolerable
If you don't need to debug your native code, you could simply not add native support in the first place and just build it on the command line when needed. Then your eclipse project would simply act as a Java only project and build quickly.
I had this problem with 50 ish projects in my workspace. Not all of them are open at once. Still the 'Android Library Update' would show up every time I needed to update a small thing on every project and really slow me down.
I tried following but the last one worked like a charm for me.
Obviously, opening only related projects helps too.
Removing Build Automatically gets rid of this problem but makes twice more problems. You end up wasting more time manually building the projects. Didn't work for me at all.
Selectively building only the projects that changed helps too.
But the main thing that completely fixed this problem for me was following
Go to Window->Preference->Android->Build and make sure the third check box Skip packaging and dexing until export or launch. is marked on.

Huh? Android Preferences page refuses to load after adding SDK 1.6

This one is really weird. I had a perfectly working Eclipse + Android 2.2 SDK working in both Administrator account and LUA (Limited User Account) under Windows XP.
Then I decided to add the Android 1.6 SDK (I could do it from an Administrator account only). It seemed to have gone well, since it still works perfectly -- but only in that Administrator account!
When I try to start Eclipse under a LUA, I receive the following error message box:
Which disappears within 2-3 seconds and replaced with:
I then tried to check the Preferences page, but again, all I receive is error messages:
and:
Any idea why this is happening and how to fix this?
(I would love to be able to continue working from a LUA)
Update: I have uploaded the error log file (referred to in the "Show Error Log" in the message boxes), for your expert examination. Hopefully this can shed some light on the mystery.
The full answer is somewhat complex, concerning Eclipse's configuration area, the workspace area, etc. This is all documented on the Eclipse site, if you're interested.
But there's a simpler, more immediate approach, since you're not trying to run multiple users simultaneously on the same copy, over a network -- in which case you'd need the full answer.
Simply install Eclipse in a directory, say, C:/dev/Eclipse. Make sure both your limited user and your admin have write access to everything. Run Eclipse as the limited user. It should start right up, as there's nothing privileged that is needed by Eclipse.
At this point, you can lock it down as read-only if you desire. By default, all the configuration is stored within the Eclipse installation directory.
I'd suggest starting with a fresh install at this point, to eliminate any inconsistencies that you may have introduced. Though you should be able to reset things by deleting all the subdirectories of the configure/ directory (but not the config.ini). There's an official way to do that, but that's part of the full answer. :=)
I'd also suggest using a different workspace for each user, to avoid any permissions problems.
But my BIG suggestion is -- upgrade to Windows 7, and do NOT run Eclipse as an administrator!
Anyway, once you have it working -- to upgrade in the future, make the Eclipse directory completely writable by the limited user, and then update as the limited user, and then make it read-only again if needed.
Note: This is the cheating way. The REAL answer is to give each user their own configuration directory. This is only viable because you have control over both users and can coordinate any updates.
Try running eclipse by downloading the binary and unzipping and directly running the .exe rather than "installing" it. The android tools should work this way if you configure the appropriate paths to them, and if eclipse isn't "installed" but simply run from a the archive folder, it should try to download plugins and such into its own directory (owned by your user), which may solve your problem.
I doubt the Android developers who built the tools run under LUAs, so they probably didn't run into this problem...
Workaround found: Run Eclipse as Administrator (Right-click exe/shortcut, then select "Run as...", then enter Administrator's password).
This is a workaround, not a solution, but it does allow me to continue working while logged in LUA.
Thanks to #David who suggested this solution here: Android ADT Plugin doesn't show up in Eclipse
Update: Solution found:
Enable the Security tab in Windows XP Pro (""Use Simple File Sharing.")
Add the LUA account to C:\eclipse with Modify permissions.
That's it. No need to run Eclipse via "Run as". Also eliminates the need for a fresh install (which takes more time).

Categories

Resources