Reputation: 103
I'm running Android Studio 0.8.6 and imported two Firebase libraries, to use in my project.
I manage to create objects of Firebase Simple Login classes, and also default Firebase objects. However. When I try to access any method of these object, Android Studio stubbornly says "Cannot resolve symbol ".
This is my code (it's basically Firebase quick start sample code):
Firebase myRef = new Firebase("https://xxxxxxxx.firebaseIO.com/");
SimpleLogin authClient = new SimpleLogin(myRef, this);
authClient.checkAuthStatus(new SimpleLoginAuthenticatedHandler() {
@Override
public void authenticated(FirebaseSimpleLoginError error, FirebaseSimpleLoginUser user) {
if (error != null) {
// Oh no! There was an error performing the check
} else if (user == null) {
// No user is logged in
} else {
// There is a logged in user
}
}
});
authClient.createUser("[email protected]", "very secret", new SimpleLoginAuthenticatedHandler() {
public void authenticated(FirebaseSimpleLoginError error, FirebaseSimpleLoginUser user) {
if(error != null) {
// There was an error creating this account
}
else {
// We created a new user account
}
}
});
It is the methods '.checkOutStatus' and '.createUser' which cannot be resolved.
I've been trying every way descibed here on SO to fix it, but nothing worked out. I also attach my build.gradle file beneath:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 16
targetSdkVersion 19
}
}
dependencies {
// Support Libraries
compile 'com.android.support:appcompat-v7:19.1.0'
compile files('libs/firebase-simple-login-1.4.1.jar')
compile files('libs/firebase-client-jvm-1.0.16.jar')
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Thanks in advance! :)
Upvotes: 3
Views: 8843
Reputation: 3372
To use the Firebase Messaging service you need to add the following dependencies to your app's build.gradle file:
compile 'com.google.firebase:firebase-messaging:9.4.0'
All other firebase dependency files are :
dependencies {
apply plugin: 'com.google.gms.google-services'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.firebase:firebase-client-android:2.5.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
}
I had the same problem but thanks to this answer:
https://stackoverflow.com/a/39353961/4836759
Upvotes: 0
Reputation: 1236
For resolving symbol issues, consider if your project has a settings.gradle
that is NOT in the root directory, a bug in Android Studio causes it not read submodules correctly.
Here is my answer for another question that sounds similar to yours: https://stackoverflow.com/a/25224773/936067
Upvotes: 2