1

My layout preview is empty and don't show rendering issue i use android studio 3.0.1 Here is my :

build.gradle(app)

    apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'


android {
    signingConfigs {
        config {
        }
    }
    compileSdkVersion 27
    buildToolsVersion '27.0.2'
    defaultConfig {

        applicationId "com.example.epa.ouza_rebuild"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}
repositories {
    maven {
        url 'https://dl.bintray.com/spark/maven'
    }
    maven {
        url 'https://maven.google.com'
    }
    mavenCentral()
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile files('libs/android-query-full.0.26.7.jar')
    //new library from github
    compile 'de.hdodenhof:circleimageview:2.2.0'
    compile 'me.spark:submitbutton:1.0.1'
    compile "com.squareup.picasso:picasso:2.4.0"
    compile 'com.google.firebase:firebase-database:11.8.0'
    compile 'com.android.support:appcompat-v7:27.0.2'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.firebase:firebase-crash:11.8.0'
    compile 'com.google.firebase:firebase-auth:11.8.0'
    compile 'com.google.android.gms:play-services-auth:11.8.0'
    compile 'com.google.firebase:firebase-storage:11.8.0'
    compile 'com.android.support:support-v4:27.0.2'
    compile 'com.android.support:design:27.0.2'
    compile 'com.firebaseui:firebase-ui-database:2.3.0'
    compile 'com.baoyz.pullrefreshlayout:library:1.2.0'
    compile 'com.android.support:cardview-v7:27.0.2'
    compile 'com.github.medyo:fancybuttons:1.8.4'
    compile 'io.saeid:fab-loading:1.0.0'
    compile 'junit:junit:4.12'
    compile 'com.github.bumptech.glide:glide:4.6.1'
    testCompile 'junit:junit:4.12'
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services'
android {
    // Fixed build error : Duplicate files copied in APK META-INF/xxx
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE.txt'
    }
}
apply plugin: 'kotlin-android-extensions'

build.gradle(project)

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.2.21'
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }

        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // google-services plugin
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://jitpack.io"
        }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }

}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Manifest :

   <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.epa.ouza_rebuild">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    <application
        android:allowBackup="true"
        android:fullBackupContent="@xml/backup_descriptor"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".Ajouter" />
        <activity
            android:name=".Home2"
            android:label="@string/title_activity_home2" />
        <activity android:name=".ItemDetails" />
        <activity android:name=".WishList" />
        <activity android:name="connexion_et_inscription.Log1" />
        <activity android:name="connexion_et_inscription.Log2" />
        <activity android:name="connexion_et_inscription.Inscris" />
        <activity android:name=".Profile"/>
    </application>

</manifest>

I tried to:

  • Invalidate cache and Restart android studio
  • Sync Project gradle
  • change API level to 26,25,24,23,21
  • Change Theme for Application to AppTheme or Holo
  • Create new activity, new Project but the same problem continue

Please Help me, am I make some mistake ?

jeydi243
  • 39
  • 1
  • 10

1 Answers1

0

I'm getting the same problem since I import and add some material components. If you add any material components to your project I think that's the issue.

For the test that is the issue for material components or not, first invalidates caches and restarts, then when the android studio restarts, don't open the infected layout again, as it will break all of the android layout previews showing and then test something else that don't have any material components :)

But don't worry, it will fix in the next version.

Note: Thanks to Johnny Zen for the report here.