Проблемы при переходе на новый Places SDK

#android #android-gradle-plugin #build.gradle

#Android #android-gradle-плагин #build.gradle

Вопрос:

Когда я пытаюсь перейти на новый Places SDK и добавить новую зависимость от места, как показано ниже :

 implementation 'com.google.android.libraries.places:places:1.0.0'
  

это выдает много ошибок для другой зависимости, как показано ниже.

Не удалось разрешить зависимость для ‘:app@debug /compileClasspath’: Не удалось разрешить com.github.bumptech.glide: glide: 4.3.1.

Не удалось разрешить зависимость для ‘:app@debug /compileClasspath’: Не удалось разрешить com.google.code.gson:gson: 2.8.5.

Не удалось разрешить зависимость для ‘:app@debug /compileClasspath’: Не удалось разрешить com.mcxiaoke.volley: библиотека: 1.0.19.

Не удалось разрешить зависимость для ‘:app@debug /compileClasspath’: Не удалось разрешить com.github.bumptech.glide: glide: 4.3.1.

я получаю ошибку 40, подобную приведенной выше.

когда я удаляю places, проект libs работает нормально.

Зависимость от файла gradel на уровне моего приложения, как показано ниже:

 dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    compile 'com.android.support:multidex:1.0.1'
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile('com.crashlytics.sdk.android:crashlytics:2.6.1@aar') {
        transitive = true;
    }
    implementation 'com.facebook.android:facebook-android-sdk:4.1.0'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:support-annotations:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.jakewharton:butterknife:7.0.1'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.android.libraries.places:places:1.0.0'
    implementation 'com.google.guava:guava-collections:r03'
    implementation 'com.etsy.android.grid:library:1.0.5'
    implementation 'com.wdullaer:materialdatetimepicker:2.5.0'
    implementation 'com.google.firebase:firebase-messaging:17.4.0'
    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.daimajia.numberprogressbar:library:1.2@aar'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.mcxiaoke.volley:library:1.0.19'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.3. '
    implementation 'org.apache.httpcomponents:httpcore:4.4.5'
    implementation 'org.apache.httpcomponents:httpclient:4.5'
    compile project(':mediapicker')
    //compile project(':linkedin-sdk')
    compile project(':sinch-android-rtc-3.11.1')
}
  

Мой файл Greadle уровня проекта, как показано ниже :

 buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.0.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

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

Я сталкиваюсь с этой ошибкой уже 2 дня, пожалуйста, дайте какое-нибудь решение.

Ответ №1:

Обновите зависимости на уровне вашего проекта, как показано ниже:

 classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.google.gms:google-services:4.1.0'
  

И обновите зависимости уровня вашего приложения, как показано ниже:

 implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
  

Не забудьте добавить «применить плагин: ‘com.google.gms.google-services'» в конце вашей оценки уровня приложения

И если все еще не работает, вам нужно сделать, как показано ниже:

 //exclude glide coming from place api
implementation ('com.google.android.libraries.places:places:1.0.0'){
    exclude module: 'glide'
}