I get the following error while upgrading a firebase project from old domain to new google firebase domain.
Failed to resolve: com.google.firebase:firebase-core:9.0.0
I followed the steps mentioned on the Firebase documentation, in the section Add Firebase to your Android Project, topic Available libraries.
What are my options to resolve this error?
Update Aug 2017
As of version 11.2.0 Firebase and Google Play services dependencies are available via Google's Maven Repo. You no longer need to use the Android SDK manager to import these dependencies.
In your root build.gradle file add the repo:
allprojects {
repositories {
// ...
maven { url "https://maven.google.com" }
}
}
If you are using gradle 4.0 or higher you can replace maven { url "https://maven.google.com" } with just google().
The 9.0.0 version of Firebase was built using Google Play services 9.0 and is now available under the new packaging com.google.firebase:*
See Release Notes for Google Play services 9.0
https://developers.google.com/android/guides/releases#may_2016_-_v90
New versions of packages Google Play Services (rev 30) and Google Repository (rev 26) were just released in the SDK manager so it's likely you just need to update.
Downloading Google Play Services and Google Repository
From Android Studio:
Click Tools > Android > SDK Manager.
Click into the SDK Tools tab.
Select and install Google Play Services (rev 30) and Google Repository (rev 26). See the image below.
Sync and Build your project.
From IntelliJ IDEA:
As of April 2017, the latest versions of Google Play Services and Repository are listed below.
Click Tools > Android > SDK Manager.
Under the Packages panel, Look for the Extras.
Select and install Google Play Services (rev 39) and Google Repository (rev 46). See the image below.
Perform a gradle project sync and Build your project.
Go to Android SDK Manager and install the latest version of below two libraries
Google Play Services
Google Repository
Error:(30, 13) Failed to resolve: com.google.firebase:firebase-auth:9.6.1
If you ever get this error and you are using Android studio 2.2 that comes with firebase component integrated in it which has libraries version 9.6.0 by default and you are adding the latest dependencies like 9.6.1 . You might need to downgrade com.google.firebase:firebase-auth:9.6.1 to com.google.firebase:firebase-auth:9.6.0
Or check the library version of your pre-installed firebase and make sure it is of the same version with the new library you are trying to add or added to your project.
Tried all the above, use the Firebase Assistant! It is the simplest way to solve this. First remove all the dependencies you added to the build.gradle (using the manual method) and then in Android Studio:
Click Tools > Firebase to open the Assistant window.
It really is as easy as that.
Faced myself and seen several times in comments for similar questions - that even after installing "latest" Google Play Services and Google Repository still having the same issue.
The thing is that they may be latest for your current revision of Android SDK Tools, but not that latest your app build requires.
In such case make sure to install latest version of Android SDK Tools first, and probably Android SDK Platform-tools (both under Tools branch). Also please note you may need to go through this several times if you haven't updated for a long time (i.e. install latest Android SDK Tools and Android SDK Platform-tools, then restart Android SDK Manager, then repeat), since the updates seem to be going through some critical mandatory milestones and you cannot install the very latest if you currently have the revision which is pretty "old".
dependencies {
compile 'com.google.android.gms:play-services-maps:11.8.0'
compile 'com.google.android.gms:play-services-auth:11.8.0'
compile 'com.google.android.gms:play-services-ads:11.8.0'
compile 'com.google.firebase:firebase-storage:11.8.0'
}
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 {
maven { url 'https://maven.fabric.io/public' }
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
Following are the prerequisites if you want to add firebase to your project.
For working with Firebase you should install Android Studio 1.5 or higher.
Download the latest Google Play services SDK from through Android SDK Manager.
The device should be running Android 2.3 (Gingerbread) or newer, and Google Play services 9.2.0 or newer.
I could only find out all this after hours of struggle.
Source: Adding Firebase to your Android App
If using command line tools, do
sdkmanager 'extras;google;m2repository'
sdkmanager 'extras;android;m2repository'
Need to Update
Android SDK : SDK Tools -> Support Repository -> Google Repository
After updating the Android SDK need to sync gradle build in Android studio.
In my case, on top of adding google() in repositories for the project level gradle file, I had to also include it in the app level gradle file.
repositories {
mavenLocal()
google()
flatDir {
dirs 'libs'
}
}
If all the above methods are not working then change implementation 'com.google.firebase:firebase-core:12.0.0' to implementation 'com.google.firebase:firebase-core:10.0.0' in your app level build.gradle file.
This would surely work.
I tried all the solutions and nothing worked for me. Changing gradle version worked for me.
I changed following inside gradle-wrapper.properties
from
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
Update October 2022
com.google.firebase-core has been deprecated in October 2022. Instead of firebase-core, use firebase-analytics or firebase-analytics-ktx.
The firebase-core library is deprecated and no further versions will
be released. This SDK included the Firebase SDK for Google Analytics.
Now, to use Google Analytics or a product that recommends adding
Google Analytics, you need to explicitly declare the Analytics
dependency: com.google.firebase:firebase-analytics or
com.google.firebase:firebase-analytics-ktx.
Release notes
I'm doing an Android app that needs the latest support library.
If I understand correctly the latest version is 22.2.0
So I'm trying to get the com.android.support - appcompat-v7 version 22.2.0 dependency but it is not found on search.maven.org
As one can see, it is the one required by the gradle dependency on this article:
http://androidgifts.com/navigation-view-using-design-support-library/#comment-11
The latest android sdk android-sdk_r24.3.3-linux.tar does not have it. It only has the 22.2.0 version.
How come Maven does not have it ?
Any way to download it ?
As mentioned here > Android support library setup with maven google actually don't care much for maven users...
One of the answers mentioned there might help you (probably not as easy as you'd like, but...): https://stackoverflow.com/a/22602712/4405559
I'd also advise you to try finding a github repo containing the newest appcompat (the question I've linked has also got an answer mentioning how you can create your own repo, if needed).
I have just followed the steps in this stackoverflow answer in my maven project: https://stackoverflow.com/a/22602712/4405559 and it works perfectly.
<dependency>
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
<version>22.2.0</version>
<type>aar</type>
</dependency>
The gradle dependency would be:
compile 'com.android.support:appcompat-v7:22.2.0#aar'
(If it doesn't find it you may need to add the local android support m2repository folder to your repositories. See this answer: https://stackoverflow.com/a/25365406/2199475)
Just make sure you have run check for updates in the Android SDK Manager and install the correct api and associated SDK Build-tools.
I'm developing my own library for android. I want to allow other developers to use my library via the dependencies section in the gradle file.
What should I do in order to enable this?
Thanks.
You need to deploy your library to Bintray and link your package to JCenter (that's the default repository configured when you create a new project with Android Studio).
Here are some instructions on how to get started.
Please note that Bintray does not support SNAPSHOTs, but you can get a free account in oss.jfrog.org if you have a Bintray package linked to JCenter.
Here a project example that has all the pieces in place (look for gradle scripts in /gradle directory)
I'm tryng to setup the new AdMob SDK using instructions on this Google site for ANT (not gradle).
This answer talks about the same problem, but it was asked before google decided to do awat with .jars distribution for Admob and included it in google play services.
I am baffled that the official site does not even talks about ANT configuration at all.
Is there a way to set it up, or do I have to give up and use gradle instead ?
If you use Ant you are pretty much on your own.
You will need to :
Unpack the Google Play Services AAR
Add each of the embedded jars onto your build classpath
Add each of the embedded jars onto your DEX path
Or you can use Maven or Gradle.
If you are using Maven (my choice) then just add the following dependency to your project. NB you will want to include the android-maven-plugin in your POM too.
https://github.com/simpligility/android-maven-plugin
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services</artifactId>
<version>${play-services.verson}</version>
</dependency>
I have an Android Project where I need to build multiple versions of the same application from the same sources.
To do this, I use the android plugin for Maven
Each version must be able to include ads from admob. So in my POM I added this dependancy
<dependency>
<groupId>com.admob.android</groupId>
<artifactId>ads</artifactId>
<version>20101109-ANDROID-3312276cc1406347</version>
<scope>system</scope>
<systemPath>THE_PATH\libs\admob-sdk-android.jar</systemPath>
</dependency>
I don't get any errors at build time but, when I execute the application I get this exception
java.lang.ClassNotFoundException: com.admob.android.ads.AdView
So apparently the package is not properly included ?
You can NOT use system scope for runtime required libraries. Deploy the jar into your local repository or your repository server (using e.g. mvn install:installFile ..) and remove scope and systemPath from the dependency declaration.
Update: As of the latest releases my Maven Android SDK Deployer can do the install of the AdMob jar from the SDK into your local Maven repository or repository server for you.
To use the Maven Android SDK Deployer, do the following:
Clone the repo:
git clone https://github.com/mosabua/maven-android-sdk-deployer.git
Go to your SDK Manager and install all APIs (this may take a while if you haven't done it yet)
Make sure you have the correct environment variable set for ANDROID_HOME. For Windows this might be:
set ANDROID_HOME=c:/android-sdk-windows
Run the installer:
c:\Tools\maven-android-sdk-deployer>mvn install
After you have done this you can just use all the android dependencies from your pom.xml, e.g.
<dependency>
<groupId>com.google.android.admob</groupId>
<artifactId>admob</artifactId>
<version>6.4.1-r11</version>
</dependency>
(There's a whole list on the github page)