androidandroid-studioandroid-3.1-honeycomb

Android Studio 3.1.4 does not show layout preview


I recently installed an update of android studio v 3.1.4 and I am trynig to design some Layout for my app . But the previous does not showing the result of my Xml code . When i synchronize the project it run succefully ..where is the matter ?

i tried many time to fix this problem by changing some dependencies to make it work
such as 'com.android.support:appcompat-v7:28.0.0-alpha3' : by other version but still always not showing the previous . i also tried to clean and rebuild the project .

enter image description here

> Here some files   
> 
> > main_activity.xml
> > 
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <android.support.v4.widget.DrawerLayout
> > > xmlns:android="http://schemas.android.com/apk/res/android"
> > >     xmlns:app="http://schemas.android.com/apk/res-auto"
> > >     xmlns:tools="http://schemas.android.com/tools"
> > >     android:layout_width="match_parent"
> > >     android:layout_height="match_parent"
> > >     tools:context=".MainActivity">
> > > 
> > > 
> > > <RelativeLayout
> > >     android:id="@+id/rel"
> > >     android:layout_width="match_parent"
> > >     android:layout_height="match_parent">
> > 
> >     <FrameLayout
> >         android:id="@+id/main_container"
> >         android:layout_width="match_parent"
> >         android:layout_height="match_parent"
> >         android:layout_alignParentLeft="true"
> >         android:layout_alignParentStart="true"
> >         android:layout_alignParentTop="true">
> > 
> >         <android.support.v7.widget.RecyclerView
> >             android:id="@+id/all_users"
> >             android:layout_width="match_parent"
> >             android:layout_height="match_parent">
> > 
> >         </android.support.v7.widget.RecyclerView>
> >     </FrameLayout> </RelativeLayout>
> > 
> >     <android.support.design.widget.NavigationView
> >         android:layout_width="wrap_content"
> >         android:layout_height="match_parent"
> >        android:layout_gravity="start"
> >         android:layout_marginBottom="3dp"></android.support.design.widget.NavigationView>
> > 
> > </android.support.v4.widget.DrawerLayout>

APP.GRADLE

    apply plugin: 'com.android.application'
android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.chaabane.takwa.myapplication"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
   .................
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'


    implementation 'com.android.support:design:28.0.0-alpha3'
    implementation 'com.android.support:cardview-v7:28.0.0-alpha3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
 implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation 'com.google.firebase:firebase-database:11.8.0'
    implementation 'com.google.firebase:firebase-storage:11.8.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

apply plugin: 'com.google.gms.google-services'

**

> PROJECT.BUILD

**

  dependencies {
        classpath 'com.android.tools.build:gradle:3.1.1'



        classpath 'com.google.gms:google-services:3.1.1'
    }
}

Solution

  • I had the same problem and to resolve it you need to temporally downgrade

    compileSdkVersion 28 -> 27
    targetSdkVersion 28 -> 27
    
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3' --> 27.1.1
    implementation 'com.android.support:design:28.0.0-alpha3' --> 27.1.1
    implementation 'com.android.support:cardview-v7:28.0.0-alpha3' --> 27.1.1
    

    I think there is a problem on those library when Android Studio have to render XML layout.

    Alternatively, Google released yesterday Android Studio 3.2.0 Upgrade your IDE, change support libraries with 28.0.0 and everything will work