I am using Firebase authentication to sign up using phone number. But any sms not being send.
I am getting this error
W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod()
returned Gms: com.google.firebase.auth.api.internal.zzak#d5a4a6d
My gradle file
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0-beta01'
implementation 'com.google.android.material:material:1.1.0-alpha07'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0-alpha01'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.13-beta-3'
androidTestImplementation 'androidx.test:runner:1.3.0-alpha01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha01'
}
I understand you have missed setting up Firebase in your application.
Follow the whole process from here
Make sure you have google-services.json file in in the module (app-level) directory of your app.
Your root-level (project-level) Gradle file (build.gradle) must have these lines.
buildscript {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
}
dependencies {
// ...
// Add the following line:
classpath 'com.google.gms:google-services:4.2.0' // Google Services plugin
}
}
allprojects {
// ...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
// ...
}
}
Then In your module (app-level) Gradle file (usually app/build.gradle), add a line to the bottom of the file.
apply plugin: 'com.android.application'
android {
// ...
}
// Add the following line to the bottom of the file:
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin
In your module (app-level) Gradle file (usually app/build.gradle), add the dependency for the core Firebase SDK:
dependencies {
// ...
implementation 'com.google.firebase:firebase-core:17.0.0'
// Getting a "Could not find" error? Make sure that you've added
// Google's Maven repository to your root-level build.gradle file
}
Related
I have a modification I want to do to android settings in order for it to be compatible with older versions so I added to the dependencies
implementation "com.android.support:recyclerview-v7:$support_version"
//implementation "com.android.support:appcompat-v7:$support_version"
This produced the error
Could not get unknown property 'support_version' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I added the following to the top of the build.gradle file also
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
}
Please what am I doing wrong?
In order to progress I had to comment the two lines out so that the android can compile but I need to make it backward compatible in production.Android
Try with below dependency In App gridle File
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
Project level Gridle File
buildscript {
ext.kotlin_version = '1.4.20'
repositories {
google()
jcenter()
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
}
com.android.support is deprecated. Replace by androidx
implementation "androidx.recyclerview:recyclerview:1.2.0-beta01"
implementation "androidx.appcompat:appcompat:1.3.0-alpha02"
You are missing the "support_version" variable in your Gradle script.
Try this:
add this to your build.gradle
ext.main = ['support_version' : 'X.X.X']
and in your dependency structure, you can add.
implementation "com.android.support:recyclerview-v7:${main.support_version}"
NB: make sure you have valid version number.
I am new to android development environment and I need to connect my app to firebase but I am getting this error
Failed to resolve: firebase-auth-15.0.0
This error is shown in the statement:
implementation 'com.google.firebase:firebase-auth:15.0.0' //16.0.1
I tried to change the above statement to
implementation 'com.google.firebase:firebase-auth:16.0.3'
But then firebase dependency is not setting up.
You should use firebase-auth:16.0.4 version.
implementation 'com.google.firebase:firebase-auth:16.0.4'
FYI
At first, add rules to your root-level build.gradle file, to include the google-services plugin and the Google's Maven repository:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:4.1.0' // google-services plugin
}
}
allprojects {
// ...
repositories {
// ...
google() // Google's Maven repository
}
}
After that, Clean-Rebuild-Run.
Read Add Firebase to Your Android Project
Update the dependency to the following:
implementation 'com.google.firebase:firebase-auth:16.0.4'
Also add firebase-core:
implementation 'com.google.firebase:firebase-core:16.0.4'
https://firebase.google.com/support/release-notes/android
Please also update google-services plugin in top level gradle file:
classpath 'com.google.gms:google-services:4.1.0'
I'm trying to implement elegant number button in my app, but it's library is not syncing. Here is the gradle file.
//...
// FirebaseUI for Cloud Storage
implementation 'com.firebaseui:firebase-ui-storage:3.3.1'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.4'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.github.Hitomis:CircleMenu:v1.0.2'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
compile 'com.cepheuen.elegant-number-button:lib:1.0.2'
}
apply plugin: 'com.google.gms.google-services'
here is the error:
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.cepheuen.elegant-number-button:lib:1.0.2.
Replace compile with implementation
Add
xmlns:tools="http://schemas.android.com/tools"
tools:replace="android:theme"
to your AndroidManifest.xml (inside application tag)
this work for me :)
Replace this line:
compile 'com.cepheuen.elegant-number-button:lib:1.0.2'
With this:
implementation 'com.cepheuen.elegant-number-button:lib:1.0.2'
And also don't forget to add this to your project level build.gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
In your project File->setting check you are working offline or online...if you are working offline you need to be work online to resolve this error..
I am getting the following error:
Cannot change dependencies of configuration ':app:api' after it has been included in dependency resolution.
Updated:
I am able to build using com.google.gms:google-services:3.3.0 when data binding is disabled, but this is not a solution for someone that requires data binding to be enabled.
After Google announced the new sdk versioning system (link), I did the following steps:
I updated the gradle files as directed to include the gms and firebase version numbers separately. Updated the apply plugin line, updated the classpath. I am still getting the error and dont know the reason.
Below are relevant gradle files:
build.gradle (main):
buildscript {
repositories {
google()
jcenter()
maven { url 'https://dl.bintray.com/rvalerio/maven' }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.3.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'io.realm:realm-gradle-plugin:4.3.3'
classpath 'io.fabric.tools:gradle:1.25.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://jitpack.io' }
maven { url 'https://maven.google.com' }
}
}
build.gradle (Module:app)
apply plugin: 'com.google.gms.google-services'
Firebase dependencies:
//Firebase Dependencies
implementation "com.google.firebase:firebase-messaging:15.0.2"
implementation "com.google.firebase:firebase-core:15.0.2"
implementation "com.google.firebase:firebase-config:15.0.2"
implementation('com.crashlytics.sdk.android:crashlytics:2.9.1#aar') {
transitive = true
}
GMS and other dependencies
implementation "com.android.support:recyclerview-v7:27.1.1"
implementation "com.android.support:support-v4:27.1.1"
implementation "com.android.support:cardview-v7:27.1.1"
implementation "com.android.support:design:27.1.1"
implementation "com.android.support:support-v13:27.1.1"
implementation "com.android.support.constraint:constraint-layout:1.1.0"
implementation "com.google.android.gms:play-services-location:15.0.1"
implementation "com.google.android.gms:play-services-vision:15.0.1"
implementation "com.google.android.gms:play-services-auth:15.0.1"
implementation "com.google.android.gms:play-services-maps:15.0.1"
I have pasted the error log on pastebin from android studio 3.1.2 here.
Any help is appreciated!
managed to build against Play Services & Firebase 15.0.0 with data-binding enabled ...my dependencies now look about alike this and it builds again, without any Cannot change dependencies of configuration complaints:
buildscript {
dependencies {
classpath "com.android.tools.build:gradle:3.1.2"
// do not update, because 3.3.1 appears broken
// classpath "com.google.gms:google-services:3.2.1"
// meanwhile, there is version 4.0.2 available
classpath "com.google.gms:google-services:4.0.2"
}
}
one has to reference all the libraries individually. just referencing com.google.android.gms:play‐services and/or com.google.firebase:firebase-core does not work anymore since 15.0.0.
android {
dependencies {
// Play Services 15.0.0
implementation "com.google.android.gms:play-services-base: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"
// Firebase 15.0.0
implementation "com.google.firebase:firebase-core:15.0.2"
implementation "com.google.firebase:firebase-database:15.0.1"
implementation "com.google.firebase:firebase-firestore:16.0.0"
implementation "com.google.firebase:firebase-storage:15.0.2"
implementation "com.google.firebase:firebase-crash:15.0.2"
implementation "com.google.firebase:firebase-auth:15.1.0"
implementation "com.google.firebase:firebase-messaging:15.0.2"
implementation "com.google.firebase:firebase-config:15.0.2"
implementation "com.google.firebase:firebase-invites:15.0.1"
implementation "com.google.firebase:firebase-ads:15.0.1"
implementation "com.google.firebase:firebase-appindexing:15.0.1"
implementation "com.google.firebase:firebase-perf:15.2.0"
implementation "com.google.firebase:firebase-functions:15.0.0"
}
}
apply plugin: 'com.google.gms.google-services'
also had to edit the Manifest.xml to fix the support library:
<application>
<meta-data
android:name="android.support.VERSION"
android:value="27.1.1"
tools:replace="android:value"/>
</application
The issue with data binding and the 3.3.0 version of the google-services plugin has been reported here: https://issuetracker.google.com/issues/79122163
As of today, the bug is in the "assigned" state.
UPDATE
I could compile also with
dataBinding.enabled false
In android configuration and version 3.3.0
ORIGINAL
Same problem here with google-services:3.3.0, which is the last version, but according to docs version 3.2.1 should be used. I've been able to compile with the following
ext {
kotlin_version = '1.2.41'
firebaseCore = '15.0.2'
authentication = '15.1.0'
cloudFirestore = '16.0.0'
cloudStorage = '15.0.2'
crashlitics = '2.9.1'
googleServices = '15.0.0'
supportLibrary = '27.1.1'
facebookSdkVersion = '4.31.0'
twitterSdkVersion = '3.1.1'
firebaseUI = '3.3.1'
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha12'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:3.2.1'
}
This issue seems to have been resolved by using the new google-services release (4.0.1 as of today). Below is the relevant versions that will resolve the stated issue:
In your project build.gradle files:
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1' }
In your app build.gradle files:
//Firebase Dependencies
implementation "com.google.firebase:firebase-messaging:17.0.0"
implementation "com.google.firebase:firebase-core:16.0.0"
implementation "com.google.firebase:firebase-config:16.0.0"
implementation 'com.google.firebase:firebase-perf:16.0.0'
...} apply plugin: "com.google.gms.google-services"
Databinding is set to true as well:
dataBinding {
enabled = true
}
Android Studio version: 3.1.2
Thank you all for providing various ways you can get around the problem, such as the answer by #Kyle and the medium post link that shows you how to use firebase without google services.
Just downgrade your GooglePlay services dependency to 3.2.1 :)
classpath 'com.google.gms:google-services:3.2.1'
While not a great solution, I followed the recommendation from a Googler mentioned on the bug tracker.
I am using
com.google.gms:google-services:3.3.1
I have enabled databinding
`dataBinding.enabled true`
I removed the plugin reference from the app gradle script
//apply plugin: 'com.google.gms.google-services'
And followed the recommendations from this Medium post to include all of the necessary Google Service string values.
https://medium.com/#samstern_58566/how-to-use-firebase-on-android-without-the-google-services-plugin-93ecc7dc6c4
My app builds successfully and everything works as expected.
Everything worked after I added the google() maven inside the allProjects block in my 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()
}
}
I'm trying to use the sdk Firebase natively on Android but when I try to initialize Firebase using:
com.google.firebase.FirebaseApp.initializeApp(utils.ad.getApplicationContext();
I receive this error
System.err: Error: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process *******. Make sure to call FirebaseApp.initializeApp(Context) first.
in my app.gradle:
dependencies {
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile "com.google.android.gms:play-services-base:11.8.0"
}
can help me?
Add rules to platforms/android/build.gradle file, to include the google-services plugin and the Google's Maven repository:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.1.1' // google-services plugin
}
}
allprojects {
repositories {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
Insert firebase dependencies to App_Resources/Android/app.gradle:
dependencies {
compile 'com.google.firebase:firebase-core:11.8.0'
//compile 'com.google.firebase:firebase-messaging:11.8.0'
//compile "com.google.android.gms:play-services-base:11.8.0"
// ...
}
And at the end of App_Resources/Android/app.gradle insert:
apply plugin: 'com.google.gms.google-services'
Finally, if you hit the error:
> File google-services.json is missing. The Google Services Plugin cannot function without it.
Copy manually the google-services.jsonfile:
cp app/App_Resources/Android/google-services.json platforms/android/app/google-services.json
Meanwhile, thank you so much for your reply #attdona :)
I solved by doing more or less what you did.
The only differences are that:
To use a dynamic build.gralde I created a hook to replace the
original one with mine to compile.
Always using a hook I copied
the file google-services.json from App_Resources/Android/ to
platforms/android/app