Update firebase 11 dependency on Android Gradle - android

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

Related

Could not determine artifacts for com.google.android.gms:play-services-vision:18.0.0

I'm not able to build my project in Android Studio. I'm trying to use the google vision API for face detection and it worked fine so far, but I can't clean/ build my project because of this
This is my build error message
Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
Could not determine artifacts for com.google.android.gms:play-services-vision:18.0.0
Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-vision/18.0.0/play-services-vision-18.0.0.aar'.
Could not HEAD 'https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-vision/18.0.0/play-services-vision-18.0.0.aar'.
Remote host closed connection during handshake
SSL peer shut down incorrectly
This my build.gradle file (app level)
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.example.facedetect"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
implementation 'com.android.volley:volley:1.1.1'
implementation "com.github.bumptech.glide:glide:4.9.0"
implementation 'com.github.bumptech.glide:glide:4.9.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
implementation 'com.google.android.gms:play-services-vision:18.0.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.mindorks:paracamera:0.2.2'
}
apply plugin: 'com.google.gms.google-services'
Project level build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
buildscript {
dependencies {
// Add this line
classpath 'com.google.gms:google-services:4.3.0'
}
}
When I remove the
implementation 'com.google.android.gms:play-services-vision:18.0.0
The project build succeeds. Is something wrong with the way I'm adding the dependency?
I think you have problem with your dependency classpath. You created two buildscript dependencies. Instead, you can include one or more plugins (dependency) in same buildscript.
You can have root build.gradle as below:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.google.gms:google-services:4.3.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Also, you don't have to write google maven url maven { url 'https://maven.google.com'} separately, since google() will do the same thing for you.
I figured it out. Looks like I needed to invalidate caches and restart both android studio and my computer. Thanks for the help!

Android Studio won't build suddenly: Program type already present: com.google.android.gms.internal.auth.zzao

My project ran fine yesterday. I open it today and get this error:
Program type already present: com.google.android.gms.internal.auth.zzao
I tried updating the firebase libraries and then I get these errors and clicking install doesn't work:
Failed to resolve: com.google.firebase:firebase-core:17.3.0
Open File
Show in Project Structure dialog
Failed to resolve: com.google.android.gms:play-services-maps:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog
Failed to resolve: com.google.android.gms:play-services-location:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog
Failed to resolve: com.google.android.gms:play-services-places:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog
Failed to resolve: com.google.android.gms:play-services-auth:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog
Failed to resolve: com.google.android.gms:play-services-basement:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog
Failed to resolve: com.google.android.gms:play-services-tasks:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog
Failed to resolve: com.google.firebase:firebase-common:17.3.0
Open File
Show in Project Structure dialog
Failed to resolve: com.google.firebase:firebase-iid:17.3.0
Open File
Show in Project Structure dialog
Failed to resolve: com.google.firebase:firebase-measurement-connector:17.3.0
Open File
Show in Project Structure dialog
Failed to resolve: com.google.android.gms:play-services-gcm:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog
I tried updating the target and compile sdk to 28 and get an error for all of the support libraries being lower than target sdk but don't get an option to update them to the latest. I tried updating build tools to 28.0.2 and that also didn't help, and it weirdly doesn't prompt me that it is behind, I had to manually go look at the latest installed and put it. Not sure what to try next. Nothing changed and it just stopped working. Below are my gradle files. Thanks.
App gradle
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.8.2'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '28.0.2'
defaultConfig {
applicationId "removed"
manifestPlaceholders = [
onesignal_app_id : 'removed',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'REMOTE'
]
minSdkVersion 19
targetSdkVersion 27
versionCode 50
versionName "2.6"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:support-v4:27.1.1'
implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
implementation 'com.android.support:design:27.1.1'
implementation 'com.mikepenz:fontawesome-typeface:4.6.0.3#aar'
implementation('com.mikepenz:materialdrawer:5.6.0#aar') {
transitive = true
}
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.eminayar.panterdialog:panter-dialog:0.0.2.1'
implementation 'com.mikhaellopez:circularprogressbar:1.1.1'
implementation files('libs/core-3.2.1.jar')
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.afollestad:material-cab:0.1.12'
implementation 'com.sandrios.android:sandriosCamera:1.0.8'
implementation 'com.github.paolorotolo:appintro:4.1.0'
implementation 'com.wdullaer:materialdatetimepicker:3.5.1'
implementation 'com.onesignal:OneSignal:3.8.4'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'
implementation ('com.facebook.android:facebook-android-sdk:4.33.0') {
exclude(group: "com.google.zxing", module:"core")
}
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.snapchat.kit.sdk:creative:1.0.2'
implementation 'com.snapchat.kit.sdk:core:1.0.2'
}
apply plugin: 'com.google.gms.google-services'
Project gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url "https://maven.google.com" }
maven { url "https://storage.googleapis.com/snap-kit-build/maven" }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.firebase:firebase-plugins:1.0.4'
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url "https://maven.google.com" }
maven { url "https://storage.googleapis.com/snap-kit-build/maven" }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Update the firebase libraries:
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
and in the top level gradle file, add the google() at the beginning under repositories:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url "https://storage.googleapis.com/snap-kit-build/maven" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.firebase:firebase-plugins:1.0.4'
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://storage.googleapis.com/snap-kit-build/maven" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Android - Getting multiple errors while building the project

I am getting these errors while building the project
Failed to resolve: firebase-core
Failed to resolve: multidex
Failed to resolve: play-services-ads
Failed to resolve: play-services-auth
Failed to resolve: firebase-auth-license
Failed to resolve: common
Please check and let me know how this issue can be resolved?
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.test.android"
minSdkVersion 15
targetSdkVersion 26
versionCode 3
versionName "1.0.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
manifestPlaceholders = [onesignal_app_id : "65f11821-8462-4ec4-9e41-XXXXXXXX",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "91629XXXXX00"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation 'com.google.firebase:firebase-auth:11.6.0'
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'
})
// applovin
implementation project(':unity-ads')
//unity ads
//compile 'com.google.android.gms:play-services-ads:11.0.4'
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.android.support:design:26.+'
implementation 'com.android.support:support-vector-drawable:26.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:26.+'
implementation 'com.google.android.gms:play-services:11.6.0'
implementation 'com.android.support:multidex:1.0.1'
//compile 'com.github.cooltechworks:ScratchView:v1.1'//not used
implementation 'com.jackpocket:scratchoff:1.1.0'
implementation 'com.adcolony:sdk:3.2.1'
implementation 'com.android.support:support-annotations:26.0.1'
implementation 'com.google.android.gms:play-services-ads:11.6.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.facebook.android:facebook-share:[4,5)'
testImplementation 'junit:junit:4.12'
implementation 'com.ironsource.sdk:mediationsdk:6.7.0.1#jar'
//compile 'com.google.ads.mediation:unity:2.1.1.0' //not used
implementation 'com.google.firebase:firebase-database:11.6.0'
implementation 'com.github.bumptech.glide:glide:4.1.1'
implementation 'commons-net:commons-net:3.3'
//get server time
//compile 'com.github.instacart.truetime-android:library-extension-rx:2.0'
//compile 'com.github.instacart.truetime-android:library:2.0' // not used
implementation 'com.google.firebase:firebase-auth:11.6.0'
implementation 'com.google.firebase:firebase-core:11.6.0'
implementation 'com.google.android.gms:play-services-auth:11.6.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.onesignal:OneSignal:[3.7.1, 3.99.99]'
implementation files('libs/applovin-sdk-7.7.0-javadoc.jar')
implementation files('libs/applovin-sdk-7.7.0.jar')
}
apply plugin: 'com.google.gms.google-services'
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha09'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
maven { url "https://adcolony.bintray.com/AdColony" }
maven { url "https://dl.bintray.com/ironsource-mobile/android-sdk" }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Apparently, jcenter has started mirroring Google's repo. Try moving google() before jcenter() in the allprojects section of your project's build.gradle (like this):
repositories {
google()
jcenter()
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
maven { url "https://adcolony.bintray.com/AdColony" }
maven { url "https://dl.bintray.com/ironsource-mobile/android-sdk" }
}
Have you tried rebuilding the app? Also make sure you are using the latest version of GMS. As a sidenote you dont need to add the entire gms library, you can add selective services. I see you have added gms- and gms-ads, which would already be included in the main gms.

Facing several errors while building the project in Android [duplicate]

This question already has answers here:
Android - Getting multiple errors while building the project
(2 answers)
Closed 4 years ago.
I am getting these errors after importing the android project
Failed to resolve: firebase-core
Open File
Failed to resolve: multidex
Open File
Failed to resolve: play-services-ads
Open File
Failed to resolve: play-services-auth
Open File
Failed to resolve: firebase-auth-license
Open File
Failed to resolve: common
Show in File
I am unable to know the exact reason of this issue. Please check.
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha09'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
maven { url "https://adcolony.bintray.com/AdColony" }
maven { url "https://dl.bintray.com/ironsource-mobile/android-sdk" }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app level build.gradle
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.test.android"
minSdkVersion 15
targetSdkVersion 26
versionCode 3
versionName "1.0.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
manifestPlaceholders = [onesignal_app_id : "65f11821-8462-4ec4-9e41-XXXXX",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "916XXXXXXX00"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// applovin
implementation project(':unity-ads')
//unity ads
//compile 'com.google.android.gms:play-services-ads:11.0.4'
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.android.support:design:26.+'
implementation 'com.android.support:support-vector-drawable:26.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:26.+'
//implementation 'com.google.android.gms:play-services:11.6.0'
implementation 'com.android.support:multidex:1.0.1'
//compile 'com.github.cooltechworks:ScratchView:v1.1'//not used
implementation 'com.jackpocket:scratchoff:1.1.0'
implementation 'com.adcolony:sdk:3.2.1'
implementation 'com.android.support:support-annotations:26.0.1'
implementation 'com.google.android.gms:play-services-ads:11.6.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.facebook.android:facebook-share:[4,5)'
testImplementation 'junit:junit:4.12'
implementation 'com.ironsource.sdk:mediationsdk:6.7.0.1#jar'
//compile 'com.google.ads.mediation:unity:2.1.1.0' //not used
implementation 'com.google.firebase:firebase-database:11.6.0'
implementation 'com.github.bumptech.glide:glide:4.1.1'
implementation 'commons-net:commons-net:3.3'
//get server time
//compile 'com.github.instacart.truetime-android:library-extension-rx:2.0'
//compile 'com.github.instacart.truetime-android:library:2.0' // not used
implementation 'com.google.firebase:firebase-auth:11.6.0'
implementation 'com.google.firebase:firebase-core:11.6.0'
implementation 'com.google.android.gms:play-services-auth:11.6.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.onesignal:OneSignal:[3.7.1, 3.99.99]'
implementation files('libs/applovin-sdk-7.7.0-javadoc.jar')
implementation files('libs/applovin-sdk-7.7.0.jar')
}
apply plugin: 'com.google.gms.google-services'
EDIT: Unfortunately, I've belatedly realized that this question was a duplicate. Please refer to the answer here instead. (I'm also leaving this duplicate answer text here for now - although it will probably eventually be deleted - to preserve the solution that the original poster marked as correct.)
Apparently, jcenter has started mirroring Google's repo. Try moving google() before jcenter() in the allprojects section of your project's build.gradle (like this):
repositories {
google()
jcenter()
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
maven { url "https://adcolony.bintray.com/AdColony" }
maven { url "https://dl.bintray.com/ironsource-mobile/android-sdk" }
}
Try another version of this APIs. And you should to declare constant version and use it like {$const} then your gradle will be less error prone about versions difference.

Failed to resolve: com.google.firebase:firebase-auth:11.0.2

I just updated sdk, google play services and google repository, but still this error happened. Please help, I want to integrate authentication using phone number.
SDK Manager
Logcat
Build.gradle Module:Project
// Top-level build file where you can add configuration options common to all sub-projects/module
return
buildscript {
ext.kotlin_version = '1.1.3-2'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Build.gradle Module:App
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.*****"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
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.google.firebase:firebase-auth:11.0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
On Firebase documentation it says:
Getting a "Could not find" error? Make sure you have
the latest Google Repository in the Android SDK manager
Updating Google Repository should help with Failed to resolve issues as well (at the time of writing these lines, Google Repository version is 57).
So solving this should be rather simple. Here are the steps you should take:
Open SDK Manager.
Select SDK Tools on the top tabs.
Scroll down, under Support Repository select Google Repository.
Hit the OK button.
As soon as installation is completed, change the Firebase dependencies version to 11.0.2.
Click on the "Sync Now" button.
Enjoy Firebase =)
Seems like you forgot to include the google play services plugin add these lines of code
App level gradle
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
...
compile "com.google.firebase:firebase-core:11.0.2"
compile "com.google.firebase:firebase-auth:11.0.2"
...
}
apply plugin: 'com.google.gms.google-services' <-- this line ath the bottom of it
Project level gradle
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0' <--- This Line
}
// Getting a "Could not find" error? Make sure you have
// the latest Google Repository in the Android SDK manager
Google have shifted their new repositories from jcenter to maven google.
Add
google()
inside repositories in project build.gradle
Add Googles own maven repository to your build-gradle file:
repositories {
maven {
url 'https://maven.google.com'
// Alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
}
Source: https://developer.android.com/studio/build/dependencies.html#google-maven
Solved for me setting play-services and firebase equal versions, like this:
implementation "com.google.firebase:firebase-core:11.8.0"
implementation "com.google.firebase:firebase-messaging:11.8.0"
implementation "com.google.firebase:firebase-database:11.8.0"
implementation "com.google.firebase:firebase-storage:11.8.0"
implementation "com.google.firebase:firebase-auth:11.8.0"
implementation "com.google.firebase:firebase-config:11.8.0"
implementation "com.google.firebase:firebase-crash:11.8.0"
implementation "com.google.android.gms:play-services-maps:11.8.0"
implementation "com.google.android.gms:play-services-location:11.8.0"
implementation "com.google.android.gms:play-services-places:11.8.0"
implementation "com.google.android.gms:play-services-auth:11.8.0"
implementation "com.google.android.gms:play-services-base:11.8.0"
Try using older version of Auth.
compile 'com.google.firebase:firebase-auth:10.0.1'

Categories

Resources