我最近安装了 android studio v 3.1.4 的更新,我正在尝试为我的应用程序设计一些布局。但是前面没有显示我的 Xml 代码的结果。当我同步项目时它成功运行..哪里出了问题?
我多次尝试通过更改一些依赖项以使其工作来解决此问题,
例如 'com.android.support:appcompat-v7:28.0.0-alpha3' :通过其他版本但仍然始终不显示以前的 . 我还尝试清理和重建项目。
> 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>
应用程序级
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'
**
> 项目建设
**
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
classpath 'com.google.gms:google-services:3.1.1'
}
}
我遇到了同样的问题,要解决它,您需要暂时降级
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
我认为当 Android Studio 必须呈现 XML 布局时,这些库存在问题。
或者,谷歌昨天发布了 Android Studio 3.2.0 升级您的 IDE,使用 28.0.0 更改支持库,一切都会正常
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句