appcompat-v7:28.0.0-beta01更新后中断

时间:2018-08-07 08:31:55

标签: android-studio android-appcompat

我是Android Studio的初学者,昨天安装了它。然后,我创建了一个工作正常的空项目。今天我必须进行更新,现在我正在与该错误消息战斗:

enter image description here

如您所见,我已经包含了示例。有什么想法可以解决吗? 这是完整的app.gradle

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "at.sumser.fateandlove"
        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"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0-beta01'

    implementation 'com.android.support:support-media-compat:26.1.0'
    implementation 'com.android.support:animated-vector-drawable:28.0.0-beta01'

    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    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'

    implementation'com.google.android.gms:play-services-location:15.0.1'
}

好笑,它告诉我在SDK为28时添加'com.android.support:support-media-compat:26.1.0'吗?有什么想法吗?

更新 这也是build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.2.41'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // 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
}

现在,“ com.android.support:support-media-compat:26.1.0”也确实告诉我一个问题: enter image description here

问题:Google是否不测试其发布?还是Android Studio中的自动解析器坏了?我现在损失了将近3个小时才能找到解决此问题的方法...

1 个答案:

答案 0 :(得分:5)

更新到AppCompat 28版时,我遇到了同样的问题。

首先,我建议使用28.0.0-rc01而不是28.0.0-beta01的最新版本。

如果您仍然收到所有库必须使用完全相同的版本规范的警告,则可以强制为相应的库使用最新版本。

您可以通过在build.gradle内的应用android { }文件中添加解析策略来做到这一点,如下所示:

configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:28.0.0-rc01'
        force 'com.android.support:support-media-compat:28.0.0-rc01'
        force 'com.android.support:customtabs:28.0.0-rc01'
    }
}
相关问题