我试着在stackoverflow上查看其他类似的问题,他们建议我们更改"buildToolsVersion“的版本,但我在gradle文件中没有看到这样的词。
我的Gradle文件(项目):-
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我的build.gradle (模块:应用程序):这是我的第二个gradle文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.dhruv.testhello"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
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'
}
发布于 2018-06-08 06:07:10
我也有同样的问题。我搜索了这么多,最终发现appcompat-v7:28.0.0-alpha3
在Android Studio的“设计视图”部分有一些bug。
因此,我建议将com.android.support:appcompat-v7:28.0.0-alpha3
更改为com.android.support:appcompat-v7:28.0.0-alpha1
版本,然后单击文件->无效缓存/重新启动。沃拉一切都很好。
当然,你应该可以通过互联网下载com.android.support:appcompat-v7:28.0.0-alpha1
发布于 2018-06-11 02:39:51
Hossein Seifi的回复帮助了我,但有了一些改变
implementation 'com.android.support:design:28.0.0-alpha3'
至
implementation 'com.android.support:design:28.0.0-alpha1'
,然后单击文件->无效缓存/重新启动
发布于 2018-06-08 03:44:09
在styles.xml中,
把主题从Theme.AppCompat.Light.DarkActionBar改成Base.Theme.AppCompat.Light.DarkActionBar对我很管用。
https://stackoverflow.com/questions/50736578
复制相似问题