【问题标题】:android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class android.support.design.widget.CoordinatorLayoutandroid.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class android.support.design.widget.CoordinatorLayout
【发布时间】:2017-12-01 11:08:51
【问题描述】:

为什么当我运行我的项目时出现此错误?这是我第一次遇到这种问题!所以我希望你能帮助我!

java.lang.RuntimeException: Unable to start activity:android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class android.support.design.widget.CoordinatorLayout`

这是代码:

梯度:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
//    buildToolsVersion "24.0.1"
    defaultConfig {
        applicationId "info.androidhive.navigationdrawer"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.android.support:appcompat-v7:24.0.0-beta1'
    compile 'com.android.support:design:24.0.0-beta1'
    compile 'com.android.support:support-v4:24.0.0-beta1'
    testCompile 'junit:junit:4.12'
    compile 'com.github.bumptech.glide:glide:3.7.0'

}

【问题讨论】:

标签: java android xml


【解决方案1】:

这是因为CoordinatorLayout is added in version 24.1.0。因此,您需要将您的支持库设计更新到版本24.1.0。最好使用最新稳定的支持库26.1.0(有27版,但API状态仍处于预览模式)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-27
    • 1970-01-01
    • 2016-11-03
    • 2017-06-05
    • 2017-01-13
    • 1970-01-01
    相关资源
    最近更新 更多