代码之家  ›  专栏  ›  技术社区  ›  MDP

内部库版本错误建造。格拉德尔

  •  2
  • MDP  · 技术社区  · 7 年前

    implementation 'com.google.android.gms:play-services-analytics:16.0.1' 到我的应用程序生成.gradle我在那条线上和线上都出错了 implementation 'com.android.support:appcompat-v7:27.1.1'

    All com.android.support libraries must use the exact same version 
    specification (mixing versions can lead to runtime crashes). Found versions
     27.1.1, 26.1.0. Examples include com.android.support:animated-vector-
    drawable:27.1.1 and com.android.support:support-media-compat:26.1.0
    
    All gms/firebase libraries must use the exact same version specification 
    (mixing versions can lead to runtime crashes). Found versions 16.0.1, 16.0.0,
     15.0.1. Examples include com.google.android.gms:play-services-
    analytics:16.0.1 and com.google.android.gms:play-services-measurement-
    base:16.0.0 
    

    这是我的建造。格拉德尔

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 27
        defaultConfig {
            applicationId "com.domain.app"
            minSdkVersion 15
            targetSdkVersion 27
            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:27.1.1'
    
        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'
    
        compile 'com.android.support:recyclerview-v7:27.1.1'
        compile 'com.android.support:cardview-v7:27.1.1'
        compile 'com.facebook.stetho:stetho:1.4.2'
    
        implementation 'com.google.android.gms:play-services-analytics:16.0.1'
    
    
    
    }
    
    4 回复  |  直到 7 年前
        1
  •  1
  •   abdul rehman    7 年前

    格拉德尔 文件(包括导入的项目)。之后 清理并重建项目

        2
  •  1
  •   Tushar Chawla    7 年前

    您需要将所有Gradle文件的版本更改为同一版本。这包括所有本地库和导入的库。

        3
  •  1
  •   Eddi    7 年前

    你必须改变版本( 是所有Gradle文件(包括导入的项目)中的库的最新版本,然后必须清理并重新生成项目。 然后将所有“compile”替换为“implementation”,因为配置“compile”已过时,已被替换为“implementation”和“api”。

        4
  •  1
  •   IntelliJ Amiya    7 年前

    全部com.android.support库必须使用完全相同的版本 版本 27.1.1,26.1.0。示例包括com.android.support:动画向量-图纸:27.1.1和com.android.support:支持媒体-兼容:26.1.0

    • implementation 而不是 compile .

    你的版本

    implementation 'com.google.android.gms:play-services-analytics:12.0.1'
    

    v7:27.1.1 v7:26.1.0