Android Studio Showing Old GUI While Running Project on the Phone - android

I am new to both java and using Android Studio. This is the problem I am facing:
This is the main GUI I created in Android Studio with 2 textBoxes and 1 button and remove the action bar from it:
IMG
And this is the GUI shown after opening the project on my phone. I am currently using Oneplus 3t:
IMG
Solutions I have tried from stack overflow are:
Rebuild the project (not working)
Rerun the project and build (not working)
Restart the android studio (not working)

Try Invalidate Caches.. Goto File->Invalidate Caches/Restart->Choose "Invalidate and Restart".
Also if you have your instant run On, Try after turning it Off.
Go to settings - Search for instant run and uncheck the Enable Instant Run checkbox.

Please check in your activity what layout are you displaying.. if you need to display activity_main.xml make sure that that layout is specified in your setContentView() method

From the first screenshot, You are using constraint Layout.
The issue you mentioned occurs when you use constraint layout without giving any proper constraints.
It looks different in the studio, but when you finally run it without constraints you get the result as shown in your second screenshot.
Add proper constraints to your views.

Related

Android Studio layout design shows blank screen

When I try to to see the design of a layout, it shows a gray screen instead.This started happening in every project. Even the new projects that I didn't make any modifications on, so I'm sure this is not because of an error in the layout.
I'm using the lates Eel 2022.1.1 version.
I expected to see the layout design as usual but I see a blank screen.
Click on 'Split' button which is on right top corner, to toggle design and code or code with design.
If there any issue, will appear there.
Go to File -> Invalidate Cache and Restart or Clean and Re-Build Project again.
This is a common issue in the android studio there is nothing to worry about you can use these methods to see the layout.
Most probably you didn't download gradle properly or you need to wait a few minutes after the project build
ReBuild Project to clear unwanted android studio IDE errors
Open the XML file and see all tags are properly closed and there is no error.
Your PC is not Made for Android Studio LOL so please close the project and reopen it.

Preview is not showing for some activity

Preview is not showing for some XML files in android studio but the application works fine. In order to develop my application, I need to be able to see all preview properly
I've read several posts in StackOverflow
I change style, sdk ,but it doesn't work any way
Here are some rendering error android studio gave me
java.lang.IllegalArgumentException:
java.lang.ClassCastException#53dcf95b
java.lang.IllegalArgumentException: java.lang.ClassCastException#24df40fa
java.lang.IllegalArgumentException: java.lang.ClassCastException#269b81fb
For me I switching to text to design again and again. And sometime switching to preview and gradle at the right corner. This does the trick. Hope it help you
You may try some options:
Clean Project
Rebuild Project
Invalidate caches / Restart
Switching Multiple time Text / Design [Answerd by #Rajkumar Sharma]
Change API level
Change Theme
You may close your current project and Open another new to test that the problem is in your current project or in the Android Studio.
Check Manifest

Android Studio Layout preview not showing design

I am currently working on a project and everything was fine. Today, while I opened android studio, the design/layout preview showing white screen only. (Like the picture)
I did try:
Invalidate Cache and Restart
Force Layout Refresh
Downgrading appcombat to 27.1.1
Adding Base.Theme in style.xml
But, nothing worked. No Build errors, runs fine in emulator and design shows in emulator, but not in android studio.
Any solution would be a great help, also let me know if you need more details.
Even a new project with Hello World layout appears same. Tried, uninstalling and installing Android Studio.
I don't know what was wrong, but below steps solved my problem:
Clear caches folder from C:/Users//.grade/caches
Clear caches folder from C:/Users//.AndroidStuido3.x/system/caches
Restart Android Studio
Clean build project
After hours of experimenting and going through lots of solutions, this was the one that actually worked.
Hope anyone in the future faces this problem will find this helpful.
Chenge the theme in the design screen,and you can see your perview.
Based on the screen shot it looks like the RelativeLayout you are using can't find the resource images like 'adminIcon'. If you click on that red badge of the icon it should have a text message behind it.
Did the artwork name of the images change? Do you see them in your res/drawable folder?
I was also facing same issue resolved following this steps: https://www.youtube.com/watch?v=hMbIUVogWTo
In short answer is change appcompact-v7 "beta01" to "alpha1"
Try these, they are worked for me :
1.Rebuild project Buil > Rebuild project
Invalidate and caches
Gradale synch Setting>Synch project with gradle files
If you have tried all the solution and still problem is not solved the try doing this- just disable the toggle icon (top right icon) in xml as your layout would be visible in only night mode. enter image description here

Items Don't Display in Android Studio Blueprint or Design

so I'm trying out Android Studio for the first time, and I've already run into something. I'm following the official "first application" tutorial on developer.android.com, but it's not matching up. So, I tested this with two apps, and it wasn't like a bug in the first one exclusively, it happened in both. Here's a pic of an app where nothing has been changed and I followed the tutorial exactly:
As you can see in the hierarchy, it is supposed to have the Hello World text that displays when you make a new app. However, with me not changing anything, it's not showing up.
Any ideas?
Also to clarify, the items do show up when I run it on my device, it just doesn't show up on the computer.
Check the upper right corner of the Preview screen, you should see a red warning mark. Click on that and it will tell what is preventing Android Studio from rendering your layout.
Some times android studio stuck or something.Try doing
File->Invalidate Caches/Restart
The best solution is
Clean Project
Rebuild Project
In your style.xml file change the string parent with the below line:
parent="Base.Theme.AppCompat.Light.DarkActionBar"

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.

Categories

Resources