Mam problem z build.gradle w swojej aplikacji

0

Próbowałem dodać reklamy do swojego projektu lecz coś poszło nie tak. Dwie linijki kodu są podkreślone na czerwono

implementation 'com.android.support:appcompat-v7:27.1.1'

Opis błędu: 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.support26.1.0

Oraz ta linijka:

implementation 'com.google.android.gms:play-services-ads:17.1.1'

Opis: All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 17.1.1, 16.0.4, 16.0.3, 16.0.1, 16.0.0. Examples include com.google.android.gms:play-services-ads:17.1.1 and com.google.android.gms:play-services-measurement-base:16.0.4

Oto moje gradle (Project)

Build.gradle (Project):

buildscript {

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'

}
}

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

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

build.gradle (Module):

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.example.user.app"
    minSdkVersion 21
    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.3'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
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'
 }
1

Przecież w opisach tych błędów wszystko jest jasno napisane. Używane przez ciebie biblioteki korzystają z innej, tej samej biblioteki tylko że w różnych wersjach. Musisz podbić jedną z nich lub wymusić w gradle wersje tej wspólnej.

configurations.all {
    resolutionStrategy { 
        force 'wspólna biblioteka o którą się rozchodzi'
       // przykład dla guavy
        force 'com.google.guava:guava-gwt:14.0.1'
    }
}

1 użytkowników online, w tym zalogowanych: 0, gości: 1