Android Studio: My layouts are all gone. What happened? - android

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.

Related

Cannot click next in Asset Studio when creating an icon

Not sure where to post this issue I have with Android Studio IDE, I hope it can be answered here.
When I open the Asset Studio in Android Studio by right clicking on my Android Module and selecting new -> Image Asset I cannot get past the first screen. Even when I leave this default, when I try and press next the Asset Window start shaking shortly after a second or two.
I encountered this problem with a prior version of Android Stuido but an update to the latest version did not help.
I tried updating the android SDK and build tools since they are obviously related but without success.
I tried restarting Android Studio but the "bug" still remains.
Perhaps I am doing something wrong, I created a video of my workflow and the issue I am encountering.
I had the same problem.
In the Legacy tab, I set the Google Play Store Icon to No and I could pass the first screen.
I had exactly the same problem while I was trying to create adaptive icon from vector graphics.
What helped me was that I need to set Size to 108 dp x 108 dp when I imported Vector Asset (res -> right click -> New -> Vector Asset).
I have faced the same issue with vectors that had a dashed line. Android Studio doesn't support dashed-strokes by default. You can check what is not supported in this link Dashes stroke-dasharray in Android Vector. So in such cases Android Studio just doesn't show any error upfront.
In your case I see its happening even for normal vectors.
To check why its failing notice every time it fails the exclamation mark at the extreme bottom right of Android Studio turns red and flashes. Just close pop up window of Android Studio and click on the red exclamation mark. It will give you the reason why its failing. Although there was nothing much I could do about it maybe you can figure out whats wrong.
I know it's been answered but here's another thing that might fix someone else's problem when adding an asset and getting the weird shaky window error: check the asset dimensions you're importing.
I was trying to add a Vector Asset with dimensions about 23dp x 1077dp (really big height and small width), and for some reason Android Studio didn't accept it. After changing it to a dimension bigger than 170dp x 8137.3dp (it scales automatically) it worked. Then I went on the .xml file and changed it to a dimension I wanted, preserving the proportion of mostly 200dp in width or height as prompted by Lint in a warning.
I don't really know why it worked but I managed to add the asset. If anyone knows it, feel free to explain.
Steps:
1) Have you tried setting it manually through file explorer/directories etc.?
2) Maybe try a drawable importer? Like this.
3) Have a look at this answer, it might help.
4) Try completely uninstalling Android Studio, re-download and install again, if all else fails.
As per your project structure, I believe this is not a native application.
That's right, Flutter projects are not Android projects. Many Android tools are enabled only for projects that have an Android facet. Adding that to Flutter projects causes many problems, so we don't do that and this functionality available for only in native android application.
Furthermore,If you want to use may be it'll help you.
Open android studio File->Open folder->navigate to your flutter project and select the Android folder. Wait for it to sync, then navigate inside the Android studio folder and find the res folder right click on it and choose New you will see the Image asset studio.
This happened to me and the problem was that the dimensions of my source image were too small, which I think is the takeaway from all the other answers as well.
In my case the issue was caused by some unusual project structure, including some source directories added manually within the module.
The only solution was to create a new sample project in Android Studio, use the Asset Editor, generate all the assets to finally copy those to my "unusual" project.
One could also read the IDE (Android Studio) logs to see exception that are being thrown when the editor windows shakes as it's described by the Author of this thread.

Android Common XML Editor opened without graphical and source on Eclipse

I have a really wired issue.
Everything worked fine yesterday, but today when I opened the Eclipse and trying to open a layout it looks like this:
As you can see there is nothing shown(Not the name of the layout, not design and graphical tabs).
I already tried the following:
To upgrade everything in the SDK manager.
To restart everything including my computer(which in most of the time fix any problem in eclipse).
Shift+Alt+F7 doesn't work.
UPDATE:
Add to done list:
Re-Open Perspective
Window>> Reset Perspective
This is my Error Log:
right click on the layout you want to open and choose
Open with >> Android Common XML Editor,
try this as well
Window>> Reset Perspective
sometime graphical layout show. but nothing showing. only blank. this is happen because the manifest minimum sdk is not support to view the layout.to resolve that change the api level which display in the right corner of layout display area.
There are 2 solutions that found:
Convert the project to Android Studio.(I don't take it because I've a complex project)
I Re-install the Eclipse.
Hope that it will help someone to save some time.

Upgraded eclipse now getting main.xml: NotFoundException: null - Saga continues

I looked up on getting an emulator for a tablet and noticed a suggested that on checking for updates within eclipse , the latest SDK/ADT etc would provide this. At the moment I cannot check this because I am getting the following error on my main.xml file.
error!
NotFoundException: null
Exception details are logged in Window > Show View > Error Log
The following classes could not be found:
- ToggleButton (Change to android.widget.ToggleButton, Fix Build Path, Edit XML)
I have tried the three options it offers and on choosing edit XML nothing appears to show an error.
This project runs under Android 1.6 (wanted to make it as backward compatible as possible) and trying to cope with different screen sizes and orientations . At the moment I have the following layout folders:
layout(empty folder)
layout-large
layout-normal
layout-normal-land
layout-small
layout-xlarge
These all existing before the eclipse/android updates and I never had these errors. I searching the net on these , I read one suggestion of Project->clean (done this) and I then did Project->Build.
I also a suggestion to remove r.java so I have done this and ran clean and build. Still getting the same error. Oddly the code and the xml show no signs of errors apart from the above message appears at the bottom of the designer window for the XML.
The designer is set to 1.6 (API4) so it is not that the designer thinks I am on a different version to my project.
Update 1:
Since moving onto 2.1 - I found that although the layout does not show the error straight away, it then appears if I try and make any changes to it. Also I have updated the images and these do not appear to have changed either.
Update 2:
feco has suggested a reasonable suggestion of moving the build target to 2.1 as only a small percentage of users operate with a 1.6 handset now. I have decided to do this , it is more of a get around than a solution but it will have to do right now.
I had the same problem. I solved it by changing from API4 to API10 (or more) in the "Graphical Layout" window -> upper menu -> Android logo (green robot) at the end

Android: Graphical Layout not working - doesn't show anything

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.

Blank Graphical Layout?

I don't get this. I've searched everywhere and no one's answers have solved this for me.
Why does this keep happening? I can't do anything! The XML Code is still there, but it doesn't show anything in the Graphical Editor. The Palette comes up if I change it to "4in WVGA (Nexus S)" or some other configuration, but I still can't see anything and the Theme drop down menu is unselectable. All my XML documents are like that.
Just delete any custom device screen configuration you have added . It will solve the issue :)
That just happen to me and after some attempts I found the reason.
When I first opened the project in eclipse I found some errors related with the version of Java. I changed the JDK compliance to 1.6 (Project->Properties->Java Compiler) and all errors dissapear but all graphical layouts went blank.
I uncheked "Enable project specific settings" (Project->Properties->Java Compiler) and now all the graphical layouts are working.
When everything fails, close eclipse and start it all over again, it solved my problem.
I also had that problem, it happened to me when i imported my project. after some time I came to reason just change the workspace of eclipse to folder, which contains your folder.
I changed workspace on opening eclipse, there can be some other way as well
hope this will solve it
If it has never worked for you (or something went wrong upgrading your SDK, as in my case), you may need to install an extra package. For me the issue was fixed when I installed Android Native Development Tools under NDK Plugins (SDK version 20).
I had this problem since I switched the option Show previews in the palette. I switched to show only icons, everything is ok now.

Categories

Resources