Cannot resolve symbol "FirebaseAuth" - android

I still have this error inspite of me adding
compile 'com.google.android.gms:play-services-auth:11.8.0'
compile "com.google.android.gms:play-services-gcm:11.8.0" to the build.gradle(app).Please help me resolve this problem.

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:3.2.0' // google-services
plugin
}
}
allprojects {
// ...
repositories {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
Then, in your module Gradle file (usually the app/build.gradle), add the
apply plugin line at the bottom of the file to enable the Gradle plugin:
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
// ...
compile 'com.google.firebase:firebase-core:11.8.0'
// Getting a "Could not find" error? Make sure you have
// added the Google maven respository to your root build.gradle
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

You may need to make sure that your activity is importing the Firebase Auth module.
In the .java file for your activity (eg. Login.java):
import com.google.firebase.auth.FirebaseAuth;

Related

There is no fabric key and secret on the site

I am trying to add fabric to my project but there is no where to provide the api key or secret on fabric.io?
Is this ok?
apply plugin: 'io.fabric'
`Please add maven and dependencies in project-level build.gradle
buildscript {
repositories {
// ...
// Add repository
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
// ...
// Check for v3.1.2 or higher
classpath 'com.google.gms.google-services:4.2.0'
// Add dependency
classpath 'io.fabric.tools:gradle:1.28.1'
}
}
allprojects {
// ...
repositories {
// ...
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
// ...
}
}
In your app-level build.gradle,add plugin and dependencies :
apply plugin: 'io.fabric'
dependencies {
// ...
// Check for v11.4.2 or higher
implementation 'com.google.firebase:firebase-core:16.0.8'
// Add dependency
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.0'
}
Follow below link https://firebase.google.com/docs/crashlytics/get-started?platform=android . Add your project into Firebase Console.

Nativescript gradle project-level

I want to use Segment (with Firebase) into my NativeScript app. So I must follow this instructions : https://segment.com/docs/destinations/firebase but I must modify two files : the Module-level build.gradle :
buildscript {
dependencies {
// Add these lines
compile 'com.segment.analytics.android:analytics:4.+'
compile 'com.segment.analytics.android.integrations:firebase:+'
}
}
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'
and the Project-level build.gradle :
buildscript {
dependencies {
// Add this line
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
// Add this line
maven { url 'https://maven.google.com' }
}
}
But with NativeScript I have only one build.gradle. So, how can I implement this lines in gradle ?
Thanks !
I know this question is old but they may help someone in the future. Nativescript Docs aren't the best and this worked for me so it MAY not work for you.
This applies for Plugins and Regular Apps.
Buildscript Gradle.
App_Resources/Android/buildscript.gradle
PLUGINS buildscript.gradle
repositories {
// Add this line
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.google.gms:google-services:3.1.0'
}
App Grade
PLUGINS include.gradle
App_Resources/Android/app.gradle
dependencies {
compile 'com.segment.analytics.android:analytics:4.+'
compile 'com.segment.analytics.android.integrations:firebase:+'
}
apply plugin: 'com.google.gms.google-services'
HOWEVER
The compile configuration still exists but should not be used as it will not offer the guarantees that the api and implementation configurations provide.https://docs.gradle.org/current/userguide/java_library_plugin.html
You can also write this as
App Grade
PLUGINS include.gradle
App_Resources/Android/app.gradle
dependencies {
implementation 'com.segment.analytics.android:analytics:4.+'
implementation 'com.segment.analytics.android.integrations:firebase:+'
}

Adding realtime database to my app on android studio - Failed to resolve: firebase-database-15.0.0

i've been working with firebase to access an activity on my project. Everything works fine, no compilation errors. However after i go to tools > firebase i can connect to my app easily, however when i try to click Add Real time database it shows me this:
build.gradle will include these new dependencies:
compile 'com.google.firebase:firebase-database:16.0.1:15.0.0'
Since compile is deprecated i use implementation, and when i do
Implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0'
i get the following error Failed to resolve: firebase-database-15.0.0
and my sync fails.
Change Root Gradle to
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
}
}
allprojects {
// ...
repositories {
// ...
google() // Google's Maven repository
}
}
And App Gradle To
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
// ...
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
// Getting a "Could not find" error? Make sure you have
// added the Google maven respository to your root build.gradle
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
Hope This May Help You
add jcenter() in your project-level gradle.
allprojects {
repositories {
google()
jcenter()
}
}
and keep remaining as #Tomin B said.

Error: cannot find symbol/class Firebase in android studio

I am following the firebase assistant and video tutorial. I am receiving an error and it says that (see picture below)
Here is my code:
I had the same problems with Button, EditText, and View; but I resolved that by adding import statements. Is there any way import Firebase?
Just import com.google.firebase.database.FirebaseDatabase
Simply you goto Firebase Console and add your required dependecies like com.google.firebase:firebase-database:11.4.0 you have to add this line in your app/build.gradle
make sure have to add core dependency in app/build.gradle which is compile 'com.google.firebase:firebase-core:11.4.0'
android {
// ...
}
dependencies {
// ...
compile 'com.google.firebase:firebase-database:11.4.0'
compile 'com.google.firebase:firebase-core:11.4.0'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
in your build.gradle you've to add this snippet
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.1.0' // google-services
plugin
}
}
allprojects {
// ...
repositories {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
Happy to help you

tikxml and Gradle

I'm trying to use tikxml library.
I put this in build.gradle (app) :
apply plugin: 'com.neenbedankt.android-apt'
...
dependencies {
...
// tikxml
compile "com.tickaroo.tikxml:annotation:${libs.tikxml}"
compile "com.tickaroo.tikxml:core:${libs.tikxml}"
apt "com.tickaroo.tikxml:processor:${libs.tikxml}"
}
And this in my build.gradle (project) :
buildscript {
...
dependencies {
...
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
ext {
libs = [tikxml : '0.8.9-SNAPSHOT']
}
But I'm getting this error when I build the project :
Error:Could not find com.tickaroo.tikxml:processor:0.8.9-SNAPSHOT.
Searched in the following locations:
file:/opt/android-sdk/extras/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/maven-metadata.xml
file:/opt/android-sdk/extras/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.pom
file:/opt/android-sdk/extras/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.jar
file:/opt/android-sdk/extras/google/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/maven-metadata.xml
file:/opt/android-sdk/extras/google/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.pom
file:/opt/android-sdk/extras/google/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.jar
file:/opt/android-sdk/extras/android/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/maven-metadata.xml
file:/opt/android-sdk/extras/android/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.pom
file:/opt/android-sdk/extras/android/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.jar
file:/opt/android-studio/gradle/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/maven-metadata.xml
file:/opt/android-studio/gradle/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.pom
file:/opt/android-studio/gradle/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.jar
https://jcenter.bintray.com/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/maven-metadata.xml
https://jcenter.bintray.com/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.pom
https://jcenter.bintray.com/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.jar
Required by:
LVS.Training.Android.Lab.SimpleEpubReader:app:unspecified
I have no folder named m2repository in /opt/android-sdk/extras/. I checked the URL where Gradle tried to download the library (https://jcenter.bintray.com/com/tickaroo/tikxml/ and there no tickaroo subdir in com : https://jcenter.bintray.com/com/
Anybody knows if there is a problem with this library ?
Since this is a SNAPSHOT release (which means it is not a stable 1.0 release),
you have to include the snapshot repository url in your build.gradle file (from where com.tickaroo.tikxml:processor:0.8.9-SNAPSHOT etc. will be downloaded):
You have to add the url "http://oss.sonatype.org/content/repositories/snapshots" to your repositories section of your root build.gradle file:
repositories {
mavenCentral()
maven {
url 'http://oss.sonatype.org/content/repositories/snapshots'
}
}

Categories

Resources