Wizcorp / phonegap-facebook-plugin

The official plugin for Facebook in Apache Cordova/PhoneGap
Other
1.91k stars 2k forks source link

Android build failing after installing phonegap-facebook-plugin #532

Open yanismydj opened 10 years ago

yanismydj commented 10 years ago

After installing the phonegap-facebook-plugin, Android will fail on every build for me.

For a test, I ran the following:

cordova create myApp
cd myApp/
cordova platform add android

At this point, running cordova build android will work correctly. However, after running cordova -d plugin add /Users/ylhert/dev/phonegap-facebook-plugin --variable APP_ID="redacted" --variable APP_NAME="redactedalso", when I run cordova build android I get the following error:

    [javac] Compiling 4 source files to /Users/ylhert/dev/phonegap/myApp/platforms/android/ant-build/classes
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:26: package com.facebook does not exist
    [javac] import com.facebook.FacebookDialogException;
    [javac]                    ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:27: package com.facebook does not exist
    [javac] import com.facebook.FacebookException;
    [javac]                    ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:28: package com.facebook does not exist
    [javac] import com.facebook.FacebookOperationCanceledException;
    [javac]                    ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:29: package com.facebook does not exist
    [javac] import com.facebook.Request;
    [javac]                    ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:30: package com.facebook does not exist
    [javac] import com.facebook.Response;
    [javac]                    ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:31: package com.facebook does not exist
    [javac] import com.facebook.Session;
    [javac]                    ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:32: package com.facebook does not exist
    [javac] import com.facebook.SessionState;
    [javac]                    ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:33: package com.facebook.model does not exist
    [javac] import com.facebook.model.GraphObject;
    [javac]                          ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:34: package com.facebook.model does not exist
    [javac] import com.facebook.model.GraphUser;
    [javac]                          ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:35: package com.facebook.widget does not exist
    [javac] import com.facebook.widget.WebDialog;
    [javac]                           ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:36: package com.facebook.widget.WebDialog does not exist
    [javac] import com.facebook.widget.WebDialog.OnCompleteListener;
    [javac]                                     ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:388: cannot find symbol
    [javac] symbol  : class Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]     private void getUserInfo(final Session session) {
    [javac]                                    ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:460: cannot find symbol
    [javac] symbol  : class SessionState
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]     private void onSessionStateChange(SessionState state, Exception exception) {
    [javac]                                       ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:71: cannot find symbol
    [javac] symbol  : class Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]         Session session = new Session.Builder(cordova.getActivity()).setApplicationId(applicationId).build();
    [javac]         ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:71: package Session does not exist
    [javac]         Session session = new Session.Builder(cordova.getActivity()).setApplicationId(applicationId).build();
    [javac]                                      ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:72: cannot find symbol
    [javac] symbol  : variable SessionState
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]         if (session.getState() == SessionState.CREATED_TOKEN_LOADED) {
    [javac]                                   ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:73: cannot find symbol
    [javac] symbol  : variable Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]             Session.setActiveSession(session);
    [javac]             ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:75: package Session does not exist
    [javac]             Session.OpenRequest openRequest = new Session.OpenRequest(cordova.getActivity());
    [javac]                    ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:75: package Session does not exist
    [javac]             Session.OpenRequest openRequest = new Session.OpenRequest(cordova.getActivity());
    [javac]                                                          ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:77: package Session does not exist
    [javac]             openRequest.setCallback(new Session.StatusCallback() {
    [javac]                                                ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:98: cannot find symbol
    [javac] symbol  : variable Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]         Session.getActiveSession().onActivityResult(cordova.getActivity(), requestCode, resultCode, intent);
    [javac]         ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:118: cannot find symbol
    [javac] symbol  : class Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]             Session session = Session.getActiveSession();
    [javac]             ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:118: cannot find symbol
    [javac] symbol  : variable Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]             Session session = Session.getActiveSession();
    [javac]                               ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:154: package Session does not exist
    [javac]                     Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(cordova.getActivity(), permissions);
    [javac]                            ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:154: package Session does not exist
    [javac]                     Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(cordova.getActivity(), permissions);
    [javac]                                                                                      ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:170: package Session does not exist
    [javac]                 session = new Session.Builder(cordova.getActivity()).setApplicationId(applicationId).build();
    [javac]                                      ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:171: cannot find symbol
    [javac] symbol  : variable Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]                 Session.setActiveSession(session);
    [javac]                 ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:173: package Session does not exist
    [javac]                 Session.OpenRequest openRequest = new Session.OpenRequest(cordova.getActivity());
    [javac]                        ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:173: package Session does not exist
    [javac]                 Session.OpenRequest openRequest = new Session.OpenRequest(cordova.getActivity());
    [javac]                                                              ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:177: package Session does not exist
    [javac]                 openRequest.setCallback(new Session.StatusCallback() {
    [javac]                                                    ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:190: cannot find symbol
    [javac] symbol  : class Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]             Session session = Session.getActiveSession();
    [javac]             ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:190: cannot find symbol
    [javac] symbol  : variable Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]             Session session = Session.getActiveSession();
    [javac]                               ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:205: cannot find symbol
    [javac] symbol  : variable Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]             callbackContext.success(Session.getActiveSession().getState().toString());
    [javac]                                     ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:208: cannot find symbol
    [javac] symbol  : class Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]             Session session = Session.getActiveSession();
    [javac]             ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:208: cannot find symbol
    [javac] symbol  : variable Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]             Session session = Session.getActiveSession();
    [javac]                               ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:258: cannot find symbol
    [javac] symbol  : class OnCompleteListener
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]             final OnCompleteListener dialogCallback = new OnCompleteListener() {
    [javac]                   ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:258: cannot find symbol
    [javac] symbol  : class OnCompleteListener
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]             final OnCompleteListener dialogCallback = new OnCompleteListener() {
    [javac]                                                           ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:309: cannot find symbol
    [javac] symbol: class WebDialog
    [javac]                         WebDialog feedDialog = (new WebDialog.FeedDialogBuilder(me.cordova.getActivity(), Session.getActiveSession(), paramBundle)).setOnCompleteListener(dialogCallback).build();
    [javac]                         ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:309: package WebDialog does not exist
    [javac]                         WebDialog feedDialog = (new WebDialog.FeedDialogBuilder(me.cordova.getActivity(), Session.getActiveSession(), paramBundle)).setOnCompleteListener(dialogCallback).build();
    [javac]                                                              ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:309: cannot find symbol
    [javac] symbol: variable Session
    [javac]                         WebDialog feedDialog = (new WebDialog.FeedDialogBuilder(me.cordova.getActivity(), Session.getActiveSession(), paramBundle)).setOnCompleteListener(dialogCallback).build();
    [javac]                                                                                                           ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:318: cannot find symbol
    [javac] symbol: class WebDialog
    [javac]                         WebDialog requestsDialog = (new WebDialog.RequestsDialogBuilder(me.cordova.getActivity(), Session.getActiveSession(), paramBundle)).setOnCompleteListener(dialogCallback)
    [javac]                         ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:318: package WebDialog does not exist
    [javac]                         WebDialog requestsDialog = (new WebDialog.RequestsDialogBuilder(me.cordova.getActivity(), Session.getActiveSession(), paramBundle)).setOnCompleteListener(dialogCallback)
    [javac]                                                                  ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:318: cannot find symbol
    [javac] symbol: variable Session
    [javac]                         WebDialog requestsDialog = (new WebDialog.RequestsDialogBuilder(me.cordova.getActivity(), Session.getActiveSession(), paramBundle)).setOnCompleteListener(dialogCallback)
    [javac]                                                                                                                   ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:343: cannot find symbol
    [javac] symbol  : class Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]             final Session session = Session.getActiveSession();
    [javac]                   ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:343: cannot find symbol
    [javac] symbol  : variable Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]             final Session session = Session.getActiveSession();
    [javac]                                     ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:367: package Session does not exist
    [javac]                         Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(cordova.getActivity(), permissionsList);
    [javac]                                ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:367: package Session does not exist
    [javac]                         Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(cordova.getActivity(), permissionsList);
    [javac]                                                                                          ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:390: package Request does not exist
    [javac]             Request.newMeRequest(session, new Request.GraphUserCallback() {
    [javac]                                                      ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:390: cannot find symbol
    [javac] symbol  : variable Request
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]             Request.newMeRequest(session, new Request.GraphUserCallback() {
    [javac]             ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:408: cannot find symbol
    [javac] symbol  : class Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]         Session session = Session.getActiveSession();
    [javac]         ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:408: cannot find symbol
    [javac] symbol  : variable Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]         Session session = Session.getActiveSession();
    [javac]                           ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:410: package Request does not exist
    [javac]         Request.Callback graphCallback = new Request.Callback() {
    [javac]                ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:410: package Request does not exist
    [javac]         Request.Callback graphCallback = new Request.Callback() {
    [javac]                                                     ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:436: cannot find symbol
    [javac] symbol  : class Request
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]         Request graphRequest = Request.newGraphPathRequest(null, graphAction, graphCallback);
    [javac]         ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:436: cannot find symbol
    [javac] symbol  : variable Request
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]         Request graphRequest = Request.newGraphPathRequest(null, graphAction, graphCallback);
    [javac]                                ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:461: cannot find symbol
    [javac] symbol  : class Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]         final Session session = Session.getActiveSession();
    [javac]               ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:461: cannot find symbol
    [javac] symbol  : variable Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]         final Session session = Session.getActiveSession();
    [javac]                                 ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:487: cannot find symbol
    [javac] symbol  : class Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]         Session session = Session.getActiveSession();
    [javac]         ^
    [javac] /Users/ylhert/dev/phonegap/myApp/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:487: cannot find symbol
    [javac] symbol  : variable Session
    [javac] location: class org.apache.cordova.facebook.ConnectPlugin
    [javac]         Session session = Session.getActiveSession();
    [javac]                           ^
    [javac] 59 errors

BUILD FAILED
/usr/local/Cellar/android-sdk/22.6.2/tools/ant/build.xml:720: The following error occurred while executing this line:
/usr/local/Cellar/android-sdk/22.6.2/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

Total time: 1 second
Error code 1 for command: ant with args: debug,-f,/Users/ylhert/dev/phonegap/myApp/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: /Users/ylhert/dev/phonegap/myApp/platforms/android/cordova/build: Command failed with exit code 2
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:700:16)
    at Process.ChildProcess._handle.onexit (child_process.js:767:5)

It appears as though I do not have the com.facebook package. Is there another step I'm missing?

maggialejandro commented 10 years ago

I'm having the same issue :(

PhoneGap 3.4.0

phonegap-fb-error

I found a related issue here #436, but it still isn't working..

ajbraus commented 10 years ago

You both have to link your FacebookSDK android projects to your main project

Project > Properties > Android > Add > path/to/facebook/sdk

aogilvie commented 10 years ago

@yanismydj have you tried adding the Facebook SDK using Eclipse or following the additional steps for command line only building?

rosshadden commented 10 years ago

@aogilvie Can you please link to or give a summary on what those "additional steps for command line only building" are?

Edit: Nevermind, I thought you were talking about something in the Facebook or Android docs, but it's a README in this very project (https://github.com/Wizcorp/phonegap-facebook-plugin/tree/master/platforms/android#setup-without-eclipse-just-cli)

om3 commented 10 years ago

Hi, I executed the command to add libs:

android update project --subprojects --path "platforms/android" --target android-19 --library "CordovaLib" android update project --subprojects --path "platforms/android" --target android-19 --library "FacebookLib"

The steps inserted automatically into platforms/android/project.properties file.

Is unnecessary to execute: echo "android.library.reference.2=FacebookLib" >> platforms/android/project.properties

aogilvie commented 10 years ago

@yanismydj any news? Can I close this?

infinito84 commented 8 years ago

This error happens when we have done several changes in build.gradle file, these lines must be readded:

debugCompile project(path: "phonegap-facebook-plugin:FacebookLib", configuration: "debug") releaseCompile project(path: "phonegap-facebook-plugin:FacebookLib", configuration: "release")