SDK版本的Android Sync问题

时间:2018-04-05 10:04:55

标签: java android firebase build.gradle build-tools

我正在开发一个Android应用程序,我在我的应用程序中使用'Firebase-Messaging'库。现在我需要'proguard'并且不幸的是,'Firebase'产生了错误。我搜索了解决方案,然后将'buildToolVersion'版本25.0.0更改为26.0.2。当我更改版本时,我得到以下错误。我尝试了很多来自互联网的解决方案,包括'Firebase Github'本身,但没有好处。我使用的是“Firebase-Messaging 12.0.1”,以下是我得到的错误。

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.2) from [com.android.support:design:26.0.2] AndroidManifest.xml:28:13-35
    is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).
    Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.

的build.gradle(项目)

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

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.2.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        maven { url 'https://maven.google.com' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

的build.gradle(模块)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.sample.firebase"
        minSdkVersion 18
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            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:design:26.0.2'
    compile 'com.android.support:appcompat-v7:26.0.0'
    compile 'com.jakewharton:butterknife:5.1.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'de.hdodenhof:circleimageview:2.2.0'
    compile 'me.angrybyte.goose:goose:1.8.0'
    compile 'com.flaviofaria:kenburnsview:1.0.7'
    compile 'com.google.firebase:firebase-messaging:12.0.1'
    compile 'com.google.firebase:firebase-core:12.0.1'
    compile 'com.jpardogo.googleprogressbar:library:1.2.0'
    testCompile 'junit:junit:4.12'
}

apply plugin: 'com.google.gms.google-services'

1 个答案:

答案 0 :(得分:0)

您需要更改以下代码行:

compile 'com.android.support:appcompat-v7:26.0.0'

compile 'com.android.support:appcompat-v7:26.0.2'

所有依赖项必须是相同的版本。