I had an Android project in eclipse, I then duplicated the project changed some of the code and updated the images, in windows explorer and eclipse the images are updated but when I run the app it uses the images from the original project, not the copy but I want the two projects to use their own images.
Any Ideas? have I missed something I needed to update in the new project?
In the "Build" folder you may see temporary files to build the application. Eclipse does not always correctly updates them because attributes of files may be violated.
If "project cleaning" has not helped you may delete the "Build" folder from the project folder.
Related
I have problem with ASSETS folder in android. I put folders and files in ASSETS, and for some folders/files I got FileNotFoundException. Then I printed all folder/file names from ASSETS folder by code, and I saw that not all folders/files are packaged into APK. Why is that happening? All files and folders have names without special characters, example: "Prevoz tereta i lica vozilima/Prevoz tereta i lica vozilima.json"? For some files/folders it works, and for some it doesn't. Does anyone know how to solve this problem? Thanks in advance!
I think I found solution for my problem. Files that needed to be in ASSETS folder were created on my desktop. I created ASSETS folder in Android Studio, but when I was putting files from desktop to assets I didn't put them via Android Studio but Windows Explorer instead. I found location of assets folder and pasted files there, so I think that Android Studio didn't index some of them. Now I created 4-5 files and folders via Android Studio (right click on assets folder -> new -> file/directory), and every one of them is packaged and working all right. So I think that was the problem and the solution. I will have to create every file and folder by hand in Android Studio, then just put data in those empty files afterwards. Thank you all for help/suggestions. I'm glad that I found the solution, even if it's stupid.
I'll make this an accepted answer tomorrow, because stackoverflow doesn't allow me to do so until tomorrow.
You have to somehow refresh your project.
If you are using Android Studio goto File>Synchronize or press 'CTRL + ALT + y'.
Make sure your assets folder is in src/main directory of your project.
file-invalidate and restart
tools-android-sync project with gradle files
READ IF USING IONIC AND TRANSFERRING FILES ATOM/OTHER IDE TO ANDROIDSTUDIO
There's an IDE interface issue.
What worked for me: removing and readding android as such:
ionic cordova platform remove android
(you might have to manually remove android folder from platforms)
ionic cordova platform add android
Then you can move on with generating a release file and then generating a signed apk in android studio etc.
I'm using Eclipse (4.2.1 Juno) on Windows 7 for my Android 2.2 project. I have several PNG resources in my drawable folders, and I'm finding that if I edit my PNG files (Paint/Photoshop etc) Eclipse doesn't recognise the file has changed and the ADT graphical layout designer still displays the old version of the image. I've tried refreshing the project folders list, tried doing a Project->Clean but neither has any affect. The only way I've found of getting Eclipse to recognise the new image version is to exit completely and restart which is a pain.
Is there some setting I can use to tell Eclipse not to 'cache' the images and always read the latest version off disk?
Try in Eclipse Project -> Clean then select your project. This will delete your R.java file and will generate new one.
That is a common problem of Eclipse that it doesn't recognize external changes for files in the workspace. The only thing I have found out to remedy this problem a little (apart from refreshing like crazy), are the refresh settings in external tools configurations. That is, if you run for example an Ant build, you can tell eclipse to refresh the workspace or specific resources afterwards. I don't know of any automatic way to do this though.
you should try saving all the unsaved resources and files after adding images ,than try out again.try cleaning both options with cleaning your single working project and with cleaning all projects.
I don't know of an automatic setting, but I have found a relatively simple manual action that seems effective. I was having the same trouble as you; now the following procedure seems to work consistently for me, with Eclipse Juno 4.2.1.
Click on the "res" folder to select it, then press F5 to refresh. Also make sure your PNG file timestamps have been touched.
Resources cached in bin\res folder.
Create script which delete folder bin\res with all content.
Add this script as external tool in builder list.
Set position in builder list - after CDT builder. Second position in list. If no CDT builder - set it first.
Enjoy.
Just updated SDK and ADT, and running a test project here now, I can't get it to build.
Android AAPT problem "invalid resource directory name", and the problem is desktop.ini which is placed in all of the res folders. It just gets put back if I delete it. The desktop.ini's also prevent r.java from being built as it depends on a clean res folder.
My workspace is on a Google Drive directory if that matters. Thanks!
I use google drive and I come across the same problem, please use windows folder browser search to search desktop.ini in the whole project folder, so that you can select all and delete them all at once. Don' t try to delete one by one in the folder. (I have 1000+ desktop.ini in the whole project)
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.
i was developing Android applications on my macbook pro after which i had to shift to the iMac at work. So i copied my Eclipse directory and the android sdk and the workspace and pasted it on the iMac at work.
I have set the Android sdk root inside the preferences of the Eclipse but the workspace is not loading inside my package explorer?
i have made the workspace folder inside the documents folder where it was in my macbook pro.
When Eclipse starts i choose the specified path of my workspace and then start eclipse.
Why are my workspace projects not being available in my package explorer?
thank you in advance.
EDIT:
i imported the project into my workspace. But there was .classpath 5.0 compatibility error, so i right clicked on my project and clicked android tools -> fix project properties. That error regarding .class path compatibility went away but a new error came in which the whole src folder inside my project has errors.. i mean each and every class.
And the error is regarding classes that come in the Android library...for eg. it is giving me error in the getCount method saying there is no such method in a class i used to extend the BaseAdapter class..what is going wrong here?
i have cleaned my project several times, but no change.
I just experienced something similar - had to create a new workspace and import the projects from my previous workspace to make it work. Pretty annoying, but it seems to be a bug in Eclipse.
Make sure that the build path of the project links correctly to the Android SDK. Right click on the project and choose configure build path and make sure that there are no red marks there.
Your project list is stored at .metadata.plugins\org.eclipse.core.resources\projects\, so you might want check that file to see if your projects are there.
from : Eclipse - No project visible in explorer
What helped me is i went to the package explorer and on the right site click the menu i.e. go to Filters -> Non Shared Projects. Remove that check mark. Then i see all projects.