After Update android studio dolphin my old projects xml preview not showing views. Is anyone facing same issue? And have done solution then please share it here.
It’s run perfectly fine but preview not working.
What I did tried?
- File -> Invalidate Cashes / Restart
- Delete build , idea , gradle folder
- Restart PC and android studio
but none of that solved my problem.
11
Answers
I ran into a similar issue when upgrading to Dolphin. I was able to solve this by changing the preview’s theme from App.Starting [default] to my app’s theme.
Have you try to using Repair IDE? It works for me
In my case, I have upgraded the project AGP (Android Gradle Plugin) and then restart the android studio.
Problem Solved.
Try to update the gradle and sync files. It work for me.
I’m suffering from same issue/bug. What I did so far?
Attempt 1
Sync Project with gradle files
Invalid catch and Restart
..gradle
folder.This will do solve in one of the my project which is only 5 screen project. But not solved in my other old projects which are more than 5 year old.
Attempt 2
Tried all step from attempt 1 Also tried what siregar2103 answered
Attempt 3
All from Attempt 1 and 2 but not solve in my main project so I decided to upgrade my years old project to latest one.
I did upgrade my Gradle from
4.1.3 to 7.3.0
Update all dependency to latest one but I face many error while doing that.
Hilt error and other errors too. Which I’m going to mention below.
For Hilt I did removed all old Hilt related library and and below
In
build.gradle
file (not.app
level)id 'com.google.dagger.hilt.android' version '2.43.2' apply false
Important note: I did add
implementation "androidx.navigation:navigation-compose:2.5.1"
dependency because I gotOther Error which I faced is
For this I did build gradle using command line and it give me full error which I didn’t get when I directly build don’t know why? But It’s through error related flat dir and aar file so I did removed flat dir code and change aar file implementation code now It’s started to build and my app started to install.
Now still some of my file not rendering and that because of I’m using custom
attr
from style so I’m trying to figuring out why it’s happening and I’ll update this answer when I find solution for that.So using above my 60% xml files preview start showing in my old projects. For 40% screen I have to change my default theme to custom theme in preview of xml so it can start rendering.
Android Gradle Plugin
This 2 step should solve your problem. And build using command line for more error related details.
The XML file in your project may contain an error. The reason may be a font issue or a file not linking correctly with your XML layout.
This is for your reference on how to find errors.
Hope you find it useful.
Check what Layout Inspectors you have enabled in Android Studio and try to let only the API 29-30 inspector active.
In my case if in xml custom views have used that my preview screen not show views if I remove or comment custom views in xml layout after that the preview screen show other view perfectly
I know removing custom layouts not solution.
for solve this issue I do following steps
First I just update Gradle plugin version to
7.3.0
from setting project structure (No working)after that I also update
com.google.gms:google-services
version to4.3.14
now every things work fine.
In my case, I have upgraded Android Gradle Plugin when update is popUp and then restart the android studio.
My Problem Solved.
I am looking as well for a soluition till now.
From what i see, it has something to do with
AGP or Cardview (Layouts). Many code snipeets relate to this issue.
I am trying to update the AGP version, but it seems, that the enveronmet is more broken than that.
I get as well an empty Field for the gradle version and plugin under settings.
For anyone can not fix this issue, i’m just need to update gradle version and buildtool
buildSrc/src/main/kotlin/Dependencies.kt
and change to 7.4 in gradle/wrapper/gradle-wrapper.properties