我的布局预览为空并且不显示渲染问题我使用android studio 3.0.1 这是我的:
的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(项目)
// 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
}
清单:
<?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>
我试图:
请帮助我,我犯了一些错误吗?
答案 0 :(得分:0)
由于导入并添加了一些材料组件,因此我遇到了同样的问题。如果您在项目中添加任何实质性组件,我认为这就是问题所在。
对于是否是材质组件问题的测试,请先使缓存无效并重新启动,然后在android studio重新启动时,请勿再次打开受感染的布局,因为它将破坏显示和显示的所有android布局预览然后测试没有任何实质性成分的其他东西:)
但是请放心,它将在下一版本中修复。
注意:感谢Johnny Zen的报告here。