在将Android Studio更新到3.1.2之后,我收到“无法加载具有未知错误的AppCompat ActionBar. ”

我尝试在stackoverflow上查找其他类似的问题,他们建议我们改变版本的“buildToolsversion”,但我在gradle文件中看不到这样的单词.

我的Gradle文件(PROJECT): –

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(模块:app):这是我的第二个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'
 }

解决方法:

我有同样的问题.我搜索了这么多,我终于发现appcompat-v7:28.0.0-alpha3与Android Studio的“设计视图”部分有一些错误.

因此,我建议将com.android.support:appcompat-v7:28.0.0-alpha3更改为com.android.support:appcompat-v7:28.0.0-alpha1版本,然后单击文件 – >使高速缓存/重新启动无效. Volla一切都好.

当然你应该有互联网访问权限下载com.android.support:appcompat-v7:28.0.0-alpha1

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...