Thomas Kaliakos
Thomas Kaliakos

Reputation: 3304

Layout preview not working in Android Studio

I ported an android project from Eclipse to Android Studio. The project builds just fine. However I am not able to see any layout preview. When I go to the Design tab of a layout I get a

Loading Configuration...

message that never goes away (see image).

enter image description here
I have set correctly the Android SDK in the project structure. This happens with all the xml files and I am not able to open the "Preview" window from

View -> Tool Windows -> Preview

I tried creating a new project and everything was showing fine. Am I missing something? Anyone faced a similar issue? Is there a chance that this is happening because the folder structure is not the default one? (The layouts are not under project/src/main/res/layout but under project/res/layout)

Upvotes: 18

Views: 24361

Answers (9)

Deepak Singh
Deepak Singh

Reputation: 51

You can try :

  1. Select Preview window(Focus on it)
  2. Unselect Floating mode and Pinned mode
  3. goto Window -> Active Tool Window ->
  4. Unselect Floating mode and Pinned mode
  5. Now you can see Docked window option here(Window -> Active Tool Window ->)
  6. Select Docked Window

Upvotes: 0

Lazar Ilic
Lazar Ilic

Reputation: 1

In Android Studio

File>Invalidate Caches/Restart

that's how i fixed

Upvotes: 0

Dhaval Jivani
Dhaval Jivani

Reputation: 9697

I had the same problem Follow this step :

Done

Upvotes: 0

Elham Kohestani
Elham Kohestani

Reputation: 3162

Just do a right click on the layout preview and click on

Show Included in contentmain.xml

you can see it in the following image enter image description here

Upvotes: 4

NdamuleloNemakh
NdamuleloNemakh

Reputation: 3791

Try updating your API to the latest version in the SDK manager ---- worked for me

Upvotes: 0

Badzalk
Badzalk

Reputation: 11

Close android studio and go to path as follow: C:\Users\user\ .AndroidStudio1.2\restart There is a file named restarter,double click on it and open android studio again,create a new project and enjoy it

Upvotes: 1

kishan
kishan

Reputation: 91

Try this

  1. Build> Clean Project
  2. Build> Rebuild Project

It worked for me

Upvotes: 9

facundofarias
facundofarias

Reputation: 3043

Maybe it is better to use the 0.3.6 version (latest), with this version of gradle : com.android.tools.build:gradle:0.6.+

Bear in mind that Android Studio will be expecting the Android SDK already installed (as I suppose you have), and also the environment variables ANDROID_HOME and GRADLE_HOME.

Upvotes: 0

Fernando Martínez
Fernando Martínez

Reputation: 1077

I had the same problem and I solved as follow

  1. Update all build.gradle files with:

classpath 'com.android.tools.build:gradle:0.5.+'

Now android studio 0.2.+ uses gradle 0.5

  1. Closes de IDE and via Terminal/Console
  2. Do a clean: $gradle clean
  3. Do a build: $gradle build
  4. Assemble it: $gradle assembleDebug
  5. Open the Android Studio and be happy ;)

Upvotes: 3

Related Questions