После обновления Gradle не удалось разрешить зависимости - PullRequest
0 голосов
/ 12 июня 2018

После обновления Gradle до последних зависимостей содержат службы Firebase и Play:

Конфигурация 'compile' устарела и заменена на 'реализация' и 'api'.

Она будет удаленав конце 2018. Для получения дополнительной информации см .: http://d.android.com/r/tools/update-dependency-configurations.html

Не удалось разрешить: play-services-base Открыть файл

Не удалось разрешить: play-services-tasks Открыть файл

Не удалось разрешить: play-services-stats Открыть файл

Не удалось разрешить: play-services-ads-identifier Открыть файл

Не удалось разрешить: play-services-basement ОткрытьФайл

build.gradle (приложение)

implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.android.gms:play-services-analytics:16.0.0'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'

Как разрешить?

Ответы [ 3 ]

0 голосов
/ 22 августа 2018

У меня та же проблема, и она решается следующим образом:

В Gradle (проект) просто измените положение google() перед jcenter(), и синхронизация и ошибка исчезнет.

repositories {
    google()
    jcenter()
}
0 голосов
/ 24 ноября 2018

А вот и объяснение.У кого-то была brilliant идея загрузить в JCenter только определение pom для com.google.android.gms:play-services-basement:15.0.1, означающее, что если JCenter был вашим первым вариантом, он найдет файл POM и попытается загрузить AAR из того жеместоположение, но это не было загружено там.Если сначала переключить порядок репозиториев с помощью google(), то теперь он правильно найдет POM и AAR в репозитории Google.

Запуск gradle app:build из командной строки скажет вам, чего не делает Android Studio:

* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find play-services-basement.aar (com.google.android.gms:play-services-basement:15.0.1).
  Searched in the following locations:
      https://jcenter.bintray.com/com/google/android/gms/play-services-basement/15.0.1/play-services-basement-15.0.1.aar

Вы можете увидеть артефакт на веб-сайте JCenter, он содержит только POM.

https://bintray.com/bintray/jcenter/com.google.android.gms%3Aplay-services-basement#files/com%2Fgoogle%2Fandroid%2Fgms%2Fplay-services-basement%2F15.0.1

В то время как репозиторий Google имеет полный набор:

0 голосов
/ 12 июня 2018

Я решил проблему.Это решение

1.add google() before jcenter()
2.exclude group:"com.google.android.gms" in facebook sdk dependencies

Мой код Gradle:

buildscript {
repositories {
    google()
    jcenter()
}

// something here ...

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.3'
    classpath "io.realm:realm-gradle-plugin:3.1.1"
    classpath 'com.google.gms:google-services:4.0.1'
}
}

allprojects {
repositories {
    google()
    jcenter()
}
}

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

И Myapp / gradle:

repositories {
   maven { url 'https://maven.fabric.io/public' }
   google()
   jcenter()
}

dependencies {
implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
    transitive = true
}

implementation ('com.facebook.android:account-kit-sdk:4.28.0'){
    exclude group:"com.google.android.gms"
}
implementation 'com.facebook.android:facebook-android-sdk:4.32.0'

implementation 'com.googlecode.libphonenumber:libphonenumber:8.9.4'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.2'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'

implementation 'com.android.support:multidex:1.0.3'
implementation files('libs/glide-3.8.0.jar')
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation('com.squareup.okhttp:okhttp-urlconnection:2.3.0') {
    exclude group: 'com.squareup.okhttp', module: 'okhttp'
}
implementation('com.squareup.okhttp:okhttp:2.3.0') {
    exclude group: 'com.squareup.okio', module: 'okio'
}
implementation 'me.relex:circleindicator:1.2.2@aar'
implementation 'com.android.support:exifinterface:27.1.1'

implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1'

implementation 'com.google.android.gms:play-services-analytics:16.0.0'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'

}
apply plugin: 'com.google.gms.google-services'
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...