After updating Gradle dependencies failed to resolve - android

After update gradle to latest dependencies contain firebase and play services:
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Failed to resolve: play-services-base
Open File
Failed to resolve: play-services-tasks
Open File
Failed to resolve: play-services-stats
Open File
Failed to resolve: play-services-ads-identifier
Open File
Failed to resolve: play-services-basement
Open File
build.gradle(app)
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'
How can I resolve?

I resolved issue.
This is solution
1.add google() before jcenter()
2.exclude group:"com.google.android.gms" in facebook sdk dependencies
My code
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
}
And 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'

I have the same problem and resolved by this:
In Gradle (project), just change the position of google() before jcenter(), and Sync and the error is gone.
repositories {
google()
jcenter()
}

And here is the explanation. Someone had the brilliant idea of uploading to JCenter only the pom definition for com.google.android.gms:play-services-basement:15.0.1 meaning that if JCenter was your first option, it would find the POM file and would attempt to download the AAR from the same location, but it hasn't been upload there. Switching the repositories order with google() now first, it will find both the POM and AAR correctly on Google's repository.
Running gradle app:build from command line would tell you what Android Studio doesn't:
* 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
You can see the artifact on JCenter's website, it only contains the POM.
https://bintray.com/bintray/jcenter/com.google.android.gms%3Aplay-services-basement#files/com%2Fgoogle%2Fandroid%2Fgms%2Fplay-services-basement%2F15.0.1
While Google repository has the complete set:
https://maven.google.com/com/google/android/gms/play-services-basement/15.0.1/play-services-basement-15.0.1.pom
https://maven.google.com/com/google/android/gms/play-services-basement/15.0.1/play-services-basement-15.0.1.aar

Related

Migrating to the New Places SDK Client in an old application

I'm trying to migrate to new sdk client inside an application.
When I tried to introduce the implementation inside my build.gradle the application throws an exception. What can I do to solve it?
What I have tried:
I have included inside build.gradle the following implementation
implementation 'com.google.android.libraries.places:places-compat:1.1.0'
also I have tried with
implementation 'com.google.android.libraries.places:places:1.1.0'
both of them throws the following error
Unable to resolve dependency for project : Could not resolve com.android.volley:volley:1.1.1.
Is anything I can do to make it compatible?
What are the changes I need to do?
Here is my build.gradle dependencies
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation files('libs/volley.jar')
implementation('de.keyboardsurfer.android.widget:crouton:1.8.1') {
exclude group: 'com.google.android', module: 'support-v4'
implementation 'com.google.maps.android:android-maps-utils:0.3+'
}
annotationProcessor 'org.parceler:parceler:1.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.7'
implementation 'com.google.android.libraries.places:places-compat:1.1.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.code.gson:gson:2.7'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.squareup:otto:1.3.5'
implementation 'com.squareup.picasso:picasso:2.3.2'
annotationProcessor 'io.realm:realm-android:0.82.0-SNAPSHOT'
implementation 'io.realm:realm-android:0.82.0-SNAPSHOT'
implementation 'com.android.support:multidex:1.0.1'
implementation 'org.parceler:parceler-api:1.1.1'
implementation 'org.apache.amber:amber-oauth2-client:0.22-incubating'
implementation 'org.apache.amber:amber-oauth2-common:0.22-incubating'
implementation 'org.slf4j:slf4j-api:1.7.12'
}
project build.gradle
buildscript {
repositories {
mavenCentral()
maven {
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
allprojects {
repositories {
mavenCentral()
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
}
}
Please verify if you have this repository added in your app level gradle file
allprojects {
repositories {
jcenter()
}
}
Also change this line
implementation files('libs/volley.jar')
to
implementation 'com.android.volley:volley:1.1.0'
As you are facing issue Program type already present: com.android.volley.AuthFailureError
Add this in your app dir build.gradle
android{
configurations {
all*.exclude group: 'com.android.volley'
}}

Failed to resolve: firebase-messaging-15.0.0

This is my build gradle (App)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.+'
implementation 'com.android.support:support-v4:26.+'
implementation 'com.github.bumptech.glide:glide:3.8.0'
implementation 'com.android.support:recyclerview-v7:26.+'
testImplementation 'junit:junit:4.12'
implementation 'com.google.firebase:firebase-auth:9.0.2'
implementation 'com.google.firebase:firebase-messaging:17.0.0:15.0.0'
}
In the build gradle (Project)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.google.gms:google-services:4.0.2'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://maven.google.com" }
}
}
Here is the error
Failed to resolve: firebase-messaging-15.0.0
The Firebase assistant show that Dependencies set up correctly, but Sycn fail. Please help me.
Try changing the version of firebase messaging to 17.3.2 like
implementation 'com.google.firebase:firebase-messaging:17.3.2'
Change this:
implementation 'com.google.firebase:firebase-messaging:17.0.0:15.0.0'
into this:
implementation 'com.google.firebase:firebase-messaging:17.3.2'
com.google.firebase is the group id
firebase-messaging is the artifact id
17.3.2 is the version
Check the versions here:
https://firebase.google.com/support/release-notes/android
Either use implementation 'com.google.firebase:firebase-messaging:17.0.0' or implementation 'com.google.firebase:firebase-messaging:15.0.0'
Following the documentation of firebase you can downloading with
implementation 'com.google.firebase:firebase-messaging:17.3.0'
Remove
implementation 'com.google.firebase:firebase-messaging:17.0.0:15.0.0'
add
implementation 'com.google.firebase:firebase-database:17.0.0'

Update firebase 11 dependency on Android Gradle

I have the follow app/build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
...
minSdkVersion 19
targetSdkVersion 27
...
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.github.IntruderShanky:scatter-piechart:1.0.0'
implementation 'com.etsy.android.grid:library:1.0.5'
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
implementation 'com.google.zxing:core:3.3.0'
testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
And follow project/build.gralde
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:3.2.1'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
When I'm hovering mouse above firebase implementations I get the follow warnings
implementation 'com.google.firebase:firebase-messaging:11.8.0' show me
A newer version of com.google.firebase:firebase-messaging than 11.8.0
is available: 17.1.0
and implementation 'com.google.firebase:firebase-core:11.8.0' show me
A newer version of com.google.firebase:firebase-core than 11.8.0
is available: 16.0.1
Then I do the sugestion and update my implementation to available version as follow
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
and sync my project. But the project show me the follow errors
Failed to resolve: play-services-base Open File
Failed to resolve: play-services-tasks Open File
Failed to resolve: play-services-stats Open File
Failed to resolve: play-services-ads-identifier Open File
Failed to resolve: play-services-basement Open File
I'm trying solve it for a long time and nothing work. Please, help me to solve it!
In the top level gradle file add the following:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Add the google() repo before jcenter() and use the latest google service plugin version 4.0.2
https://bintray.com/android/android-tools/com.google.gms.google-services/
Make sure you are connected to a good network
Try adding Google maven repository into app's build.gradle file:
repositories {
maven { url "https://maven.google.com" }
}
If step 1 won't work, remove gradle from your project root folder and rebuild your project again.
Try another
Goto >file -> other settings -> Under build, execution, and deployment
-> you will see Gradle. uncheck the checkbox offline work

Google Play Services - Could not find dependency

I'm building an app for the first time, it worked well with Google Map but a problem appeared when i added Firebase to my app.
I change some dependencies and this error occured after syncing with Gradle file :
Failed to resolve: com.google.android.gms:play-services:15.0.1
Install Repository and sync project
Show in File
Show in Project Structure dialog
Obviously i tried to click on Install Repository and sync project. During the installation, another error occured :
Could not find dependency "com.google.android.gms:play-services:15.0.1"
Here is my dependencies in build.gradle file. As you can see, i didn't forget to use implementation 'com.google.android.gms:play-services:15.0.1'.
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-annotations:28.0.0-alpha3'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.android.gms:play-services:15.0.1'
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-identity:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.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'
}
I found people with the same problem and i tried lots of proposed solutions, but the problem isn't solved.
You can see below my build.gradle project file.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:4.0.1'
classpath 'com.android.tools.build:gradle:3.3.0-alpha03'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

firebase-core:12.0.1 not found

I have created a firebase project and it says I have to modify the core version to 12 according to the picture
The default code is 9.6.1. So, I changed that number to 12.0.1
compile 'com.google.firebase:firebase-core:12.0.1'
However, the sync failed with the following error
Failed to resolve: com.google.firebase:firebase-core:12.0.1
What should I do?
Update the gms plugin:
classpath 'com.google.gms:google-services:4.0.0' // google-services plugin
and the firebase lib:
implementation 'com.google.firebase:firebase-core:16.0.0'
Also add google maven to your build.gradle file:
allprojects {
// ...
repositories {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
jcenter()
maven { url "https://jitpack.io" }
}
}
com.google.firebase:firebase-core:12.0.1 is old version already.
You can try version 15.0.0 or as Levi Albuquerque said 16.0.0
However just to remind you that if you implement more than one same kind of library, they should be always in the same version to avoid any syncing error.
Example
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.google.firebase:firebase-storage:15.0.0'
implementation 'com.google.firebase:firebase-database:15.0.0'
All are same version 15.0.0
You need to add the google() maven inside your allProjects block in your project build.gradle like this:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
...
}
}
repositories {
...
}
// You need to add the google maven in this block.
allprojects {
repositories {
jcenter()
google()
}
}
For avoid further errors in grandle beacause of a bug try to use:
classpath 'com.google.gms:google-services:3.2.1'
And for firebase use what you need from below:
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.google.firebase:firebase-analytics:15.0.2'
implementation 'com.google.firebase:firebase-appindexing:15.0.1'
implementation 'com.google.firebase:firebase-auth:15.1.0'
implementation 'com.google.firebase:firebase-firestore:16.0.0'
implementation 'com.google.firebase:firebase-functions:15.0.0'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.firebase:firebase-storage:15.0.2'
implementation 'com.google.firebase:firebase-crash:15.0.2'
implementation 'com.google.firebase:firebase-invites:15.0.1'
implementation 'com.google.firebase:firebase-perf:15.2.0'
implementation 'com.google.firebase:firebase-database:15.0.1'
implementation 'com.google.firebase:firebase-config:15.0.2'
If you using gogle play-services in your grandle set version to 15.0.0 like below example:
implementation 'com.google.android.gms:play-services-location:15.0.0'
implementation 'com.google.android.gms:play-services-maps:15.0.0'
implementation 'com.google.android.gms:play-services-places:15.0.0'
implementation 'com.google.android.gms:play-services-gcm:15.0.0'
I hope this will help you =)

Categories

Resources