Firebase dependencies set up correctly but still cannot resolve - android

New to firebase but when I try to use private FirebaseAuth mAuth; as stated in their Email Auth guide it is not able to resolve. I have set up firebase in the project and it says I have done it correctly.
Do I need to import something on that java file?
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:10.2.0'
compile 'com.android.support:design:25.3.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

You need to add:
import com.google.firebase.auth.FirebaseAuth;
Android Studio will help you with unresolved references like this one. Click on the unresolved symbol and enter Alt+Enter. The needed import will be automatically added.

Related

Could not find method compile() for arguments, org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler

I'm getting the following error
Error:(17, 0) Could not find method compile() for arguments [file collection] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I stumbled upon this error after importing a previous project done on an earlier version of Android Studio.
I. Upgrade your build tools version to 3.0.1 or later so that it recognizes the terms testImplementation , androidTestImplementation, implementation
II. Edit your build.gradle app file so that all implementation are replaced with compile
Previous
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:27.0.2'
testImplementation 'junit:junit:4.12'
// RecyclerView
implementation 'com.android.support:recyclerview-v7:27.0.2'
Should now read
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.0.2'
testImplementation 'junit:junit:4.12'
// RecyclerView
compile 'com.android.support:recyclerview-v7:27.0.2'
The above solution then generates an error about Aapt that is then fixed by adding the line below in the gradle.properties file
android.enableAapt2=false
Wonder if this was a fluke or it works every time

com.google.firebase.auth.FirebaseAuth is not linked

I try Firebase push notification in a separate Android studio project and it
work fin but when I integrate it in a existing project I had this problem .
Error :
D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
Depend:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile project(':library')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.baoyz.swipemenulistview:library:1.3.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
}
apply plugin: 'com.google.gms.google-services'
Use implementation instead of compile. Also, make sure you have implemented Firebase Auth in your project.

Unable to use Snackbar after updating Android Studio

I have recently updated my Android Studio version to 2.3
I am working on a project now and I've noticed that I am unable to import Snackbar class. I never had that problem before.
I can use it by adding compile 'com.nispok:snackbar:2.6.1' and I can import it then, but I don't think I should have to do that instead of just using Android's android.support.design.widget.Snackbar;
This is are my dependencies from build.gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
I have also tried to play around with DataBinding concept in my project but I don't think this could cause that issue?
Thank you.
You are missing the compile 'com.android.support:design:25.2.0' in your dependencies. As the library is not added you are unable to get the Snackbar class.

How to compare two intent using assertj-android

Hi I am using roboelectric for unit testing of my android application. I want to compare expected intent and actual intent using assertj-android. I have added required dependency of assertj-android, even though I have done Gradle sync multiple times but still unable to import org.assertj.android.api.content.IntentAssert.
What could be the issue ? Any idea ? Thanks in advance
build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.1'
testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:3.2.2'
testCompile 'org.khronos:opengl-api:gl1.1-android-2.1_r1'
androidTestCompile 'com.squareup.assertj:assertj-android:1.1.1'
}
AssertJ dependency in your build.gradle is for androidTest and it should be for test since you're using Robolectric?

Cannot resolve library in gradle with mavenCentral

I am building a android application with gradle in Android Studio, and i have a dependency jackson-databind, but i get a error can't resolve xxx, even i use my private repo and i sure that library is there.
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.android.support:cardview-v7:25.0.0'
compile 'com.fasterxml.jackson.core:jackson-core:2.8.1'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.1'
testCompile 'junit:junit:4.12'
}
And i get a error.
I update my gradle to 3.2 and it work well.
Sounds like you may just need to sync your build.gradle file, click the "Sync Now" like in this image here: https://postimg.org/image/v0yro39cl/

Categories

Resources