brevleq
brevleq

Reputation: 2141

Cordova-plugin-facebook4 - can't build ionic application

I'm trying build an Ionic Application in android emulator, however strangely I can't build the app. When I run ionic cordova run android the build fails with the following errors:

 symbol:   class GraphRequest
 location: class ConnectPlugin
/home/hudson/projetos/brazil-cartoon/brazil-cartoon-app/platforms/android/app/src/main/java/org/apache/cordova/facebook/ConnectPlugin.java:761: error: cannot find symbol
    GraphRequest graphRequest = GraphRequest.newGraphPathRequest(AccessToken.getCurrentAccessToken(), graphAction, new GraphRequest.Callback() {
                                                                 ^
 symbol:   variable AccessToken
 location: class ConnectPlugin
/home/hudson/projetos/brazil-cartoon/brazil-cartoon-app/platforms/android/app/src/main/java/org/apache/cordova/facebook/ConnectPlugin.java:761: error: package GraphRequest does not exist
    GraphRequest graphRequest = GraphRequest.newGraphPathRequest(AccessToken.getCurrentAccessToken(), graphAction, new GraphRequest.Callback() {
                                                                                                                                   ^
/home/hudson/projetos/brazil-cartoon/brazil-cartoon-app/platforms/android/app/src/main/java/org/apache/cordova/facebook/ConnectPlugin.java:761: error: cannot find symbol
    GraphRequest graphRequest = GraphRequest.newGraphPathRequest(AccessToken.getCurrentAccessToken(), graphAction, new GraphRequest.Callback() {
                                ^
 symbol:   variable GraphRequest
 location: class ConnectPlugin
/home/hudson/projetos/brazil-cartoon/brazil-cartoon-app/platforms/android/app/src/main/java/org/apache/cordova/facebook/ConnectPlugin.java:810: error: cannot find symbol
    final AccessToken accessToken = AccessToken.getCurrentAccessToken();
          ^
 symbol:   class AccessToken
 location: class ConnectPlugin
/home/hudson/projetos/brazil-cartoon/brazil-cartoon-app/platforms/android/app/src/main/java/org/apache/cordova/facebook/ConnectPlugin.java:810: error: cannot find symbol
    final AccessToken accessToken = AccessToken.getCurrentAccessToken();
                                    ^
 symbol:   variable AccessToken
 location: class ConnectPlugin
/home/hudson/projetos/brazil-cartoon/brazil-cartoon-app/platforms/android/app/src/main/java/org/apache/cordova/facebook/ConnectPlugin.java:864: error: cannot find symbol
    if (error instanceof FacebookServiceException) {
                         ^
 symbol:   class FacebookServiceException
 location: class ConnectPlugin
/home/hudson/projetos/brazil-cartoon/brazil-cartoon-app/platforms/android/app/src/main/java/org/apache/cordova/facebook/ConnectPlugin.java:865: error: cannot find symbol
        return getFacebookRequestErrorResponse(((FacebookServiceException) error).getRequestError());
                                                 ^
 symbol:   class FacebookServiceException
 location: class ConnectPlugin
/home/hudson/projetos/brazil-cartoon/brazil-cartoon-app/platforms/android/app/src/main/java/org/apache/cordova/facebook/ConnectPlugin.java:870: error: cannot find symbol
    if (error instanceof FacebookDialogException) {
                         ^
 symbol:   class FacebookDialogException
 location: class ConnectPlugin
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
100 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or     --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 6s
at ChildProcess.whenDone (/home/hudson/projetos/brazil-cartoon/brazil-cartoon-app/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
[2K[G(node:13843) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
[2K[G(node:13843) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The problem probably is with cordova-plugin-facebook4, as it works when I remove this plugin. I've followed the Android's guide instructions from the plugin page and don't know how to solve it. Is there something I can do to solve this and use this plugin?

Upvotes: 0

Views: 940

Answers (1)

Paresh Gami
Paresh Gami

Reputation: 4782

Just check with one specific version 1.7.4 that is working fine so please try using below command

ionic cordova plugin add [email protected] --variable APP_ID="xxxxx" --variable APP_NAME="XXXX XXXX"

Upvotes: 1

Related Questions