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
}
Related
I am trying to implement Phone Authentication using Firebase while signing in using a valid phone number I get the following log message.
2018-12-24 22:03:10.880 3021-3021/packagename W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal#b962d36
2018-12-24 22:03:12.391 3021-3021/packagename D/LoginActivity: com.google.android.gms.tasks.zzu#bcdfd40
These are my dependencies
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-config:16.1.2'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.firebaseui:firebase-ui:2.0.1'
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1#aar') {
transitive = true
}
// Check for v11.4.2 or higher
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
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'
implementation 'com.android.support:multidex:1.0.3'
}
apply plugin: 'com.google.gms.google-services'
build.gradle (Project level)
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.26.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And I have added the recently downloaded google-services.json file into this project. Actually, this code was running perfectly before I don't know why now it's showing this error after I made a few UI changes & increased the project version number.
I had a similar problem today with an old device Moto E 2nd Generation. I figured out that I had to update Play Services before I make use of any Firebase services (Auth included).
Hope it works for you!
I tried find solution on internet but nothink work for me.
After implement firebase analytics my program display this error.
Error: Program type already present: com.google.android.gms.internal.measurement.zzfg
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (Module:app)
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
implementation 'com.google.firebase:firebase-database:16.0.5'
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'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-analytics:16.0.6';
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.firebase:firebase-config:16.1.2'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
}
Try updating the dependencies to the latest version for
com.google.android.gms:play-services and com.google.firebase:
Looks like it was discussed here:
com.google.android.gms:play-services-measurement-base is being requested by various other libraries
for my Android App, I need firebase integrated. So I followed the google tutorial.
now I am always getting after implementing firebase
E/FirebaseApp: Firebase API initialization failure.
when I run the App (on Real Device and Simulation)
Already saw that: Firebase database dependency crashes app
but he is working with old versions...
So my dependencies look like this:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
implementation 'com.google.android.gms:play-services-location:16.0.0'
//implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.firebase:firebase-core:16.0.5'
}
apply plugin: 'com.google.gms.google-services'
here the projects gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
does anybody know what to do to get rid of this initalization problem?
I think, instead of adding "com.google.android.gms:play-services:", identify what is needed from playservices. Because play services is stuffed with 22 packages and you might not using all of it. This will bloat the apk size and you might cross 65K methods in your project.
I'd advice, you go through this link and pick necessary things you need from playservices.
I wanted to monetize my app using admob.
When i used the admob option available in firebase it asked me to add the following dependency 'com.google.firebase:firebase-ads:15.0.1:15.0.0'
but after the gradle build it gave me this error Failed to resolve: firebase-ads-15.0.0 so i used 'com.google.firebase:firebase-ads:12.0.1' which works great but with this one i can't see the ads. These are my dependencies :
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:26.1.0'
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'
implementation 'com.daimajia.easing:library:2.0#aar'
implementation 'com.daimajia.androidanimations:library:2.3#aar'
implementation 'com.google.android.gms:play-services:12.0.1'
testImplementation 'junit:junit:4.12'
implementation 'com.google.firebase:firebase-core:12.0.1'
//implementation 'com.google.firebase:firebase-ads:12.0.1'
//implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.firebase:firebase-ads:15.0.1:15.0.0'
}
This is my project level gradle file
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
//classpath 'com.google.gms:google-services:4.0.1'
classpath 'com.google.android.gms:strict-version-matcher-plugin:1.0.0'
classpath 'com.google.gms:google-services:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Firebase core and ads compile version should same
Try this version 16.0.4
It looks like this :
implementation com.google.firebase:firebase-core:16.0.4
implementation 'com.google.firebase:firebase-ads:16.0.4'
change line :
implementation 'com.google.firebase:firebase-ads:15.0.1:15.0.0'
to
implementation 'com.google.firebase:firebase-ads:15.0.1'
Look here Please I tried to add ML Kit to my app's build gradle but it didn't run completely. I guess it must be from my build.gradle file but I don't know where. Please help?
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
//Firebase libraries
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.google.firebase:firebase-ml-vision:16.0.0'
//Other Stuff
implementation 'com.firebase:geofire-android:2.3.0'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.android.support:support-v4:27.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.android.support:support-v13:27.1.1'
implementation 'com.r0adkll:slidableactivity:2.0.6'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.android.support:multidex:1.0.3'
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'
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'com.google.android.gms:play-services:15.0.1'
}
Below is the build.gradle(project). I have even included the google repository but still to no avail. Please help
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha03'
classpath 'com.google.gms:google-services:4.0.2'
}
}
allprojects {
repositories {
google()
jcenter()
maven{
url 'https://maven.google.com'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The Google API Release Notes indicate that support for the combined play-services library ended in April 2018:
Starting with 15.0.0, there will no longer be a play-services alias
target to pull in all Google Play services components. This has been
recommended against for some time.
You can no longer specify a dependency on the combined Google Play services target, implementation 'com.google.android.gms:play-services:15.0.1'. When this was supported with previous versions, it pulled in ALL the Google Play libs--way more than you need. See the list of APIs in Table 1 of the Setup Guide and include only the specific ones your app uses.
A check of the Google Maven Repository confirms that version 12.0.1 was the last version of the combined play-services` target.
Hopefully this line fixes it overwrites a version check that was built in recently
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.0.0'
//Google API dependencies -JACOB
implementation(project(":react-native-google-signin")){
exclude group: "com.google.android.gms" // very important excludes undeeded packages so specific ones can be grabbed
}
implementation "com.google.android.gms:play-services-base:15.0.1" // should be at least 15.0.0 to work with most recent APIS
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-vision:12.0.1') {
force = true
}
//React native camera
implementation (project(':react-native-camera')) {
exclude group: "com.google.android.gms"
implementation 'com.android.support:exifinterface:25.+'
implementation ('com.google.android.gms:play-services-vision:12.0.1') {
force = true
}
}
// Firebase dependencies -JACOB
implementation project(':react-native-firebase')
implementation "com.google.firebase:firebase-core:16.0.1"
implementation "com.google.firebase:firebase-firestore:17.0.2"
implementation "com.google.firebase:firebase-database:16.0.1"
implementation "com.google.firebase:firebase-auth:16.0.2"
//React Native Elements Vector Icons
implementation project(':react-native-vector-icons')
implementation project(':react-native-fbsdk')
implementation "com.facebook.react:react-native:+"
// From node_modules
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
apply plugin: 'com.google.gms.google-services'
//NEEDED TO RUN GOOGLE SIGN IN DUE TO DEPRACATED API IN GOOGLE DEPENDENCIES THAT CONFLICTS WITH NEW VERSIONS OF GRADLE -JACOB
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true