Android Studio says "Cannot resolve symbol" when trying to access a method in an imported library

I am running Android Studio 0.8.6 and imported two Firebase libraries for use in my project.

I manage to create Firebase Simple Login class objects as well as default Firebase objects. However. When I try to access any method of these objects, Android studio persists in saying "Cannot resolve symbol".

This is my code (basically a Firebase quickstart code example):

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@example.com", "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
        }
    }
});

      

These are the ".checkOutStatus" and ".createUser" methods and cannot be resolved.

I tried my best to describe this on SO to fix it, but nothing worked. I am also attaching the build.gradle file below:

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!:)

+3


source to share


2 answers


For symbolic problems, consider if your project settings.gradle

is NOT in the root directory, a bug in Android Studio is causing it to read submodules incorrectly.



Here is my answer to another question that is similar to yours: fooobar.com/questions/1177151 / ...

+2


source


To use the Firebase Messaging service, you need to add the following dependencies to your application build.gradle file:

            compile 'com.google.firebase:firebase-messaging:9.4.0'

      

All other firebase dependency files:



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:

/ questions / 30552 / android-cant-extend-firebase-messaging-service / 223761 # 223761

0


source







All Articles