Could not find com.google.firebase:firebase-database:9.2.0 - android

I was trying to install new firebase database into my app, but it was failed with next error:
Error:Could not find com.google.firebase:firebase-database:9.2.0. Required
by:
appName:app:unspecified
than i clone official google example frome here and was trying to build database example, but i still get same error...
looks like this is because of some google error. am i right?
in other case, why it happens and how to fix this?

You have to update/install Google Repository, revision 30 (Your android studio latest version).

Instead of adding the project, Just add google services dependency to you root level gradle classpath 'com.google.gms:google-services:3.0.0'
and firebase database dependency to your app level gradle compile 'com.google.firebase:firebase-database:9.2.0'

The part I was missing was in by build.gradle (Project:). Make sure this is there:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
It allows the project to find it in Google's Maven repository.

Related

Android Studio 3.2 - Could not find com.android.tools.build:aapt2:3.2.0-4818971

I was following a tutorial to develop icon pack for android and when I imported the project I got several errors and it was solved here - Gradle Version 4.6 - Absolute path are not supported when setting an output file name
After solving that error, the following error poped up.
Could not find com.android.tools.build:aapt2:3.2.0-4818971.
Searched in the following locations:
file:/C:/Users/Tomin Jacob/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
file:/C:/Users/Tomin Jacob/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
file:/C:/Users/Tomin Jacob/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
file:/C:/Users/Tomin Jacob/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
file:/C:/Users/Tomin Jacob/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
file:/C:/Users/Tomin Jacob/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
https://jcenter.bintray.com/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
https://jcenter.bintray.com/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
https://jitpack.io/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
https://jitpack.io/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
Required by:
project :licensing
I tried to open the URLs and I was able to download JAR (aapt2-3.2.0-4818971-windows.jar) and JSON (aapt2-3.2.0-4818971.pom.json) files from the first 2 URLs. Should I copy these files somewhere? What should I do to solve this error?
Most likely you do not have the Google repository in your project's build.gradle file. Add google() in BOTH locations as shown below:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
I was able to solve the issue by adding google() in both locations:
File -> Project Structure -> Project -> *Now add ", google()" in
Android Plugin Repository
and
Default Library Repository
*
When you upgrade to 4.6 version of gradle. You need following upgrades too. Gradle Plugin Release page.
1. Android Studio 3.+
You need Android Studio version 3.+ to have 4.6 version of gradle. At the time of post latest release was 3.2.1. You can see latest release on this page.
2. Gradle Plugin 3.1.+
You need 3.1.+ gradle plugin for gradle-4.6 support. Check in project level build.gradle.
classpath 'com.android.tools.build:gradle:3.2.1'
At the time of post latest version was 3.2.1. You can see latest release here.
3. Add Google Maven Library
You need to add Google Maven library to project level build.gradle like below code.
buildscript {
repositories {
google()
...
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
...
}
}
allprojects {
repositories {
google()
...
}
}
see the dependencies of module :licensing and use com.android.tools.build:aapt2:3.2.0 (or even "com.android.tools.build:aapt2:3.2.0:windows") there, which is the final version ...that 4818971 version should ordinary come with an alpha prefix/suffix (the version number seems to be incorrect). maybe adding repository google() might be required, too. ordinary, that dependency should be present; removing that dependency might be another possible option.
For those people who still face exactly the same problem even after adding two google to BOTH positions in relevant gradle file.I would suggest you to check Android Studio -> Preferences -> HTTP Proxy page.
If you find it says some warnings like "...have set JVM proxy to 127.0.0.1".Then you should consider vpn-related issues which depends on your context.
If your desktop is MacOS, then go to Network setting page, advance->proxy tab,uncheck all the checkbox there.
Back to your IDE as following steps: Android Studio->File->Invalidate Caches/Restart.After that,go back to check Android Studio -> Preferences -> HTTP Proxy page again,previous warnings should be gone.Run again.
I solved my issue by upgrading my classpath from
'com.google.gms:google-services:4.0.0
to
'com.google.gms:google-services:4.2.0'
hope this helps

Could not find com.google.firebase:firebase-core:11.2.0 [duplicate]

I'm getting multiple "Failed to Resolve" issues when syncing my project. They are all firebase and play-services related. I made sure they are all the same (11.2.0). I've also checked and the latest version for both is 11.2.0. Also, all the other answers to similar questions involve updating Google play services and repository in the SDK Manager but mine is already up to date.
Any idea why I can't sync my project?
EDIT - Current working solution
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.google.firebase:firebase-plugins:1.0.4'
// 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" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Add maven { url "https://maven.google.com" } to your root level build.gradle file
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Play services and Firebase dependencies are now available via maven.google.com with the release of version 11.2.0 of Google Play services and Firebase.
You can find the Google Play Services official doc here and the firebase doc here..
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
If you are using the android gradle plugin 3.x you can also use:
allprojects {
repositories {
jcenter()
google()
}
}
I just fixed same error by adding firebase-core dependency.
implementation 'com.google.firebase:firebase-core:16.0.1'
With the 16.0.0 release of firebase I had to
set most my google play services libraries to 15.0.0 analytics and tagmanager needed to be 16.0.0
set my support library versions to 27.1.1
firebase-core to 16.0.0
Built against sdk 27
Extra Changes:
I also had to update my analytics to 16.0.0
implementation "com.google.android.gms:play-services-analytics:16.0.0"
Part of the independent versions thing Android did recently I am guessing. May need to try going up or down a version on the google play services and firebase libraries
The best Method to fix this problem is not using the manual method of linking firebase to your app.
I have tried adding latest firebase repo by referring to this
Link .
It showed error " failed to resolve the dependencies firebase 11.2.0"
FireBase recommends adding firebase to your app with the help of FireBase Assistant for Android Studio Version 2.2 and Higher. Manually adding the latest library to build-gradle(module) result in an error as above.
Firebase assistant added lower versions 10.0.1 automatically to dependencies on the module gradle-build which is compatible and could be resolved.
Using Firebase assistant is so easy and 2 step process. For reference, You can use the "Use the Firebase Assistant" section on the same link mentioned above.
It Really worked Out with my Android Studio 2.3.3. And also make sure Your Google Repository is up to date
From tools-> sdk manager-> sdk tools install google play service and google repository and sync your project will work fine

Failed to resolve: com.google.firebase:firebase-core:11.2.0

I'm getting multiple "Failed to Resolve" issues when syncing my project. They are all firebase and play-services related. I made sure they are all the same (11.2.0). I've also checked and the latest version for both is 11.2.0. Also, all the other answers to similar questions involve updating Google play services and repository in the SDK Manager but mine is already up to date.
Any idea why I can't sync my project?
EDIT - Current working solution
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.google.firebase:firebase-plugins:1.0.4'
// 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" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Add maven { url "https://maven.google.com" } to your root level build.gradle file
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Play services and Firebase dependencies are now available via maven.google.com with the release of version 11.2.0 of Google Play services and Firebase.
You can find the Google Play Services official doc here and the firebase doc here..
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
If you are using the android gradle plugin 3.x you can also use:
allprojects {
repositories {
jcenter()
google()
}
}
I just fixed same error by adding firebase-core dependency.
implementation 'com.google.firebase:firebase-core:16.0.1'
With the 16.0.0 release of firebase I had to
set most my google play services libraries to 15.0.0 analytics and tagmanager needed to be 16.0.0
set my support library versions to 27.1.1
firebase-core to 16.0.0
Built against sdk 27
Extra Changes:
I also had to update my analytics to 16.0.0
implementation "com.google.android.gms:play-services-analytics:16.0.0"
Part of the independent versions thing Android did recently I am guessing. May need to try going up or down a version on the google play services and firebase libraries
The best Method to fix this problem is not using the manual method of linking firebase to your app.
I have tried adding latest firebase repo by referring to this
Link .
It showed error " failed to resolve the dependencies firebase 11.2.0"
FireBase recommends adding firebase to your app with the help of FireBase Assistant for Android Studio Version 2.2 and Higher. Manually adding the latest library to build-gradle(module) result in an error as above.
Firebase assistant added lower versions 10.0.1 automatically to dependencies on the module gradle-build which is compatible and could be resolved.
Using Firebase assistant is so easy and 2 step process. For reference, You can use the "Use the Firebase Assistant" section on the same link mentioned above.
It Really worked Out with my Android Studio 2.3.3. And also make sure Your Google Repository is up to date
From tools-> sdk manager-> sdk tools install google play service and google repository and sync your project will work fine

Failed to resolve Firebase 11.2.0 version [duplicate]

I'm getting multiple "Failed to Resolve" issues when syncing my project. They are all firebase and play-services related. I made sure they are all the same (11.2.0). I've also checked and the latest version for both is 11.2.0. Also, all the other answers to similar questions involve updating Google play services and repository in the SDK Manager but mine is already up to date.
Any idea why I can't sync my project?
EDIT - Current working solution
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.google.firebase:firebase-plugins:1.0.4'
// 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" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Add maven { url "https://maven.google.com" } to your root level build.gradle file
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Play services and Firebase dependencies are now available via maven.google.com with the release of version 11.2.0 of Google Play services and Firebase.
You can find the Google Play Services official doc here and the firebase doc here..
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
If you are using the android gradle plugin 3.x you can also use:
allprojects {
repositories {
jcenter()
google()
}
}
I just fixed same error by adding firebase-core dependency.
implementation 'com.google.firebase:firebase-core:16.0.1'
With the 16.0.0 release of firebase I had to
set most my google play services libraries to 15.0.0 analytics and tagmanager needed to be 16.0.0
set my support library versions to 27.1.1
firebase-core to 16.0.0
Built against sdk 27
Extra Changes:
I also had to update my analytics to 16.0.0
implementation "com.google.android.gms:play-services-analytics:16.0.0"
Part of the independent versions thing Android did recently I am guessing. May need to try going up or down a version on the google play services and firebase libraries
The best Method to fix this problem is not using the manual method of linking firebase to your app.
I have tried adding latest firebase repo by referring to this
Link .
It showed error " failed to resolve the dependencies firebase 11.2.0"
FireBase recommends adding firebase to your app with the help of FireBase Assistant for Android Studio Version 2.2 and Higher. Manually adding the latest library to build-gradle(module) result in an error as above.
Firebase assistant added lower versions 10.0.1 automatically to dependencies on the module gradle-build which is compatible and could be resolved.
Using Firebase assistant is so easy and 2 step process. For reference, You can use the "Use the Firebase Assistant" section on the same link mentioned above.
It Really worked Out with my Android Studio 2.3.3. And also make sure Your Google Repository is up to date
From tools-> sdk manager-> sdk tools install google play service and google repository and sync your project will work fine

Gradle can not find google play dependency

I try to repair the dependency to google play services in my android project. It already worked but now it is broken. I think this happened in between the Android Studio beta- and release-version.
This is the dependency in the build.gradle file:
dependencies {
compile 'com.google.android.gms:play-services:6.5.87'
}
Android Studio was able to autocomplete the version string: '6.5.87' So I thought it knows how to solve the dependency. But it does not.. This is what I treid:
reinstaled Android Studio (1.0.1) and the Android SDK
used several play-service versions (incl. tried to use '+')
tried to 'gradlew clean' the project
installed almost everything from the Android SDK Manager. (incl. Google Repository and Android Support Repository)
set all environment variables to the correct path
But I still get this error if I try to do a gradle project sync:
Error:Could not find com.google.android.gms:play-services:6.5.87.
Searched in the following locations:
file:/C:/Users/MyName/.m2/repository/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pom
file:/C:/Users/MaName/.m2/repository/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jar
https://repo1.maven.org/maven2/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pom
https://repo1.maven.org/maven2/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jar
https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pom
https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jar
https://oss.sonatype.org/content/repositories/releases/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pom
https://oss.sonatype.org/content/repositories/releases/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jar
Required by:
code:android:1.0
UPDATE:
Gradle is searching in "file:/C:/Users/MyName/.m2/repository/" but it should use
"file:/C:/Users/MyName/AppData\Local\Android\sdk\extras\google\m2repository" .. I dont know why this is wrong and how to fix it..
UPDATE 2
I fixed it using this workaround:
repositories {
def androidHome = System.getenv("ANDROID_HOME")
maven { url "$androidHome/extras/android/m2repository/" }
maven { url "$androidHome/extras/google/m2repository/"}
}
But I am not happy with it. Does anybody know whats wrong with my gradle?
In Android SDK Manager download the "Google Repository"
Try download the sdk and use this library
compile 'com.google.android.gms:play-services:7.0.0'
After adding jcenter() to reposetories or top level gradle file I fixed the issue
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
classpath 'com.google.gms:google-services:1.5.0-beta2'
}
}

Categories

Resources