As you might know, Remove Unused Resourceshas added recently to Android Studio, Android Studio 2.0 Preview 5.
I run this function by right click on the name of project then Refactor/Remove Unused Resources. It shows a dialog and nothing happens when I click Refactor or Preview buttons. I believe there must be a lot of problems since this is a very big project but I don't see result. Are you able to see any result?
Okay, I just found what is the problem.
The problem was, as I mentioned I was right clicking on project name and did refactoring from there. So this way doesn't work (Android Studio guys must disable this functionality to not staffing people around)
So, By running Analyze/inspect code I could see a list of unused resources. I doubled clicked on an String item then String.xml opened and by doing refactoring/remove unused resources... all resources removed :+1
So it was the trick. I could see all changed files on git. Hope it helps you guys.
Related
When I run inspect on my code it shows a warning like this:
Property "isLoading" is never used
Even though I am using that property. There are no problems with code, everything works fine, but this issue annoys me, what should I do?
You can see both warning and usage of that property in the photo below:
If the answer above doesn't work,
Go to your local drive -- Users -- Android Studio -- System
and delete the caches folder, then open android studio.
Go to file -> Invalidate Cache/Restart
Click on Invalidate Cache/Restart, a menu pops up
On the menu, click on Invalidate Cache and Restart
// Wait for android studio to restart.
I made an enormous mistake. I assumed Android Studio knew what it was doing when it said it found unused resources and I let it remove them all. It removed much needed XML id tags, it removed drawables, launcher icons.... what a mess. Has no one in Android studio land addressed this egregious set of errors? I spent a far too much time undoing all the things "Inspect code" said was wrong and I let fix only to find the app fails.
Lesson learned - never assume Android Studio knows what it is doing when it comes to inspections. Always check each before taking their often erroneous suggestion
I had several layouts for various size devices and at each orientation. Somehow, they've all disappeared and only the original layout shows again, no matter which device type or size or orientation I select in Android Studio's renderer.
I've upgraded Android Studio. I've renamed the parent folder the source project and files were in. I've upgraded the sdk. Also, Although my app is not a Gradle project, I did something the IDE kept bugging me to do... I believe I moved something from AndroidManifest to build.gradle.
I don't know which step caused me to lose my layouts, as I didn't notice as I worked on other things.
Does anyone have any idea what I might have done that would cause my layouts to disappear?
Thanks.
They have not disappeared and you have not lost them!
Click on the drop down which I have circled (It probably says Android for you) and choose "Project" view which is what you were used to before the update.
My situation is: I once made an android project(2.2 version) but soon needed to format my computer. After formatting, I downloaded eclipse again but when I imported my project, I wasn't able to use the 'graphical layout' menu for xml. It doesn't show me anything like the picture below.
http://img525.imageshack.us/img525/3586/19978552.png
I cleaned the project and updated the Android SDK, however, none of these seemed to work well. What could be causing this?
Try restarting Eclipse. Usually that solves the problem for me when that happens.
Right click on your layout xml file and select Open With -> Android Layout Editor. It will force eclipse to open file in android's layout editor mode
None of above worked for me. what worked for me is:
1- Select a Google APIs Project Build Target rather than one of the Android X.X ones. This setting is in right click on project -> Properties->Android.
2- Make a change in XML and save it. Now switch back to "Graphical Layout" and it will show the layout.
For some, only 2nd step works.
This Question was asked 3 year ago, I am sure that you have get your solution, however i was also facing the same problem but got the solution in eclipse, here it is:-
1)Goto help->AboutEclipse->Installation details.
2)check the version of Android DDMS, Android development tool, Android hierarchy viewer, Android native development tool, Android trace view and tracer for openGl ES in installed software tab.
3)If they have different version than you have to update all of them.
4)Goto help->check for update in eclipse and follow the instruction.
5)Then restart eclipse.
This solve my problem.
The topic seems a little bit cold, but I wanted to add it nonetheless.
I had a similar problem with my layouts recently. When i create a project it automatically creates the layouts in the latest version of Android (eclipse shows it as version 22 of android as of today). But i can't see anything. So i just change the version to, say 18, and it shows ok. Furthermore if i want to change it back to version 22 it throws and exception, saying that a class can't be instantiated. (I am probably missing a class or a library on my system.)
Therefore if you cant see the layout it might be a good idea to switch back to earlier versions for development. cheers.
I'm just getting started with eclipse and android development. One thing which is driving me crazy in eclipse is the problems panel with error/warning messages. It displays errors and warning from every project that I have added to eclipse. I only want to see feedback from the project (or ideally individual file) that I am currently working on).
For example, I have two android projects added to my eclipse workspace: HelloAndroid (a sample app) and SMSTest (an SMS2Toast example). Even with no files open, I see warning messages from both projects! Why is this!?! I shouldn't see any output unless I actually have a file open...or is this just the way eclipse works? Should I be using a different workspace for each project?
Thanks for any help anyone can give me.
This will get mostly what you want:
Open the "Problems" view (Shift-Alt-X-Q)
In the right hand corner there is a drop down arrow
Select "Configure contents"
Then pay attention to the "Scope" options
I also highly recommend in that same menu "Group by" -> Java problem type.
Right-click the unwanted projects and click "Close Project" you shouldn't get notifications from them at that point.
Other than that I'd recommend fixing most errors before moving away from them. If you're not prepared to complete various functions at any given time just put a stub in them that satisfies conditions with a quick //TODO: statement telling you to fix it later.
If you're talking about working on a page in general and the errors are combersome and annoying then try double-clicking on the tab for the file you're coding (above the code window) and it should become "fullscreen" hiding the other portions of eclipse.
As far as I know, this is the way eclipse works. It makes sense in that if you make a change in one file, and it causes a compilation error in another file that you don't have open you would still want to know about it.
You CAN configure which situations are considered WARN, and which are IGNORE in Preferences > Java > Compiler > Errors/Warnings.
Also, if you only want warnings from one project you can CLOSE the other project, which would keep you from having to reconfigure a new workspace for each.
I've recently starting developing with the android sdk. Currently, I am trying to add code to use a menu, however, when I try to add a menu.xml under res/menu, Eclipse hangs and freezes every time. When I reopen the Eclipse, menu.xml is there, but every time I try to open it, Eclipse hangs and freezes again.
I am running on OS X Snow Leopard, Eclipse 3.6.2 and the latest android sdk and adt plugin.
Any help, insight, thoughts?? I am thoroughly stuck.
Thanks.
Dustin
Thanks for the input guys. What ended up working for me was instead of trying to manually create a new menu.xml file, I find the add android .xml wizard and using it instead allowed me to add whatever I needed with out any hang ups.
Same problem happens for me even under the latest version of Eclipse (Helios). If I wait long enough, Eclipse reports a stack overflow exception and then this shows up in the Output window:
W/ResourceType( 5124): Bad XML block: header size 0 or total size 9949440 is larger than data size 0
menu.xml:1: error: Error parsing XML: no element found
This indicates that the XML parser isn't handling empty documents and the Android menu editor is barfing on the newly created file while trying to open it. I'm sure there is some "standard" way of creating a new menu that doesn't break the IDE but I have no idea what that method is. I'm too used to editing my files by hand but this crash/hang bug is a serious nuisance.
Dustin,
I think what has happened is, your settings have become corrupt. I highly recommend resetting all your settings. Keep in mind, you will have to re-import all your projects so this can be quite a pain, but I really think this will fix your problem.
To start, find your workspace folder and rename it to something like "workspace-bad"
Then, create an empty workspace folder to replace the one you just renamed.
Lastly, open eclipse and it will act just like a brand-new installation.
You will need to re-import your projects, which can be done by going to eclipse, hitting File>Import...
Then select under General
"Existing Projects into Workspace"
then hit "Next" and then hit "Browse" to find the root directory
also make sure "Copy project into workspace" is checked
I also recommend doing your "problem project" first, that way you don't waste your time doing the rest and then find out you have to re-create it.
I'm hoping that fixes it for you, good luck! :-)
-Jared
I ran into the same issue with the same setup. Right clicking menu.xml, selecting 'Open With', and selecting Xml Editor seemed to be a viable workaround for me.