微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在将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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐