有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java为什么我在这个代码实现的com上出错。安卓支持:appcompatv7:27.1.1'

一切顺利。安卓支持库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本27.1.1、26.1.0

当我使用此依赖项时,在放置横幅广告时出现此错误

implementation 'com.google.安卓.gms:play-services-ads:15.0.1' 

请看我提供的图片和代码,请帮助我。 我目前正在使用3.1.2 安卓 studio版本

这些是所有代码。 应用插件:com。安卓应用程序'

安卓 {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.rbtcomedy.maharashtraresult"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner 
"安卓.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-安卓.txt'), 
'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.安卓.support:appcompat-v7:27.1.1'
    implementation 'com.安卓.support.constraint:constraint-layout:1.1.0'
    implementation 'com.google.安卓.gms:play-services-ads:15.0.1'
    testImplementation 'junit:junit:4.12'
    安卓TestImplementation 'com.安卓.support.test:runner:1.0.2'
    安卓TestImplementation 'com.安卓.support.test.espresso:espresso- 
    core:3.0.2'
}

图像链接-https://drive.google.com/open?id=19WhSgZ2aTz_kZsFYeEVtejvAGBnPHJ0S


共 (2) 个答案

  1. # 1 楼答案

    espresso Core的Exlcude支持库如下:

     androidTestImplementation('com.android.support.test.espresso:espresso- 
        core:3.0.2') {
            exclude group: 'com.android.support', module: 'support-annotations'
     }
    
  2. # 2 楼答案

    用这个依赖项定义的库implementation 'com.google.android.gms:play-services-ads:15.0.1'包含26.1.0版本的库,您定义了27.1.1。所以有两个版本不同的相同lib,您可以通过排除旧lib来解决这个问题:exclude group: 'com.android.support'