Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
51 Views

Facebook* Connect Plugin + Local Notifications Plugin = BUILD FAIL

Hello fellows:

I'm developing an app for Android and iOS whith Intel XDK V2839 and I need to be able to log-in with Facebook and to use Local Notifications.

Here is a public repository on bitbucket with my project ht tps://bitb ucket.org/RodrigoTunguska/facebooklocalnotification/src/30953916da238c42ff65966d6e9a211b20f8f067?at=default inside are about 5 screen captures with build error and plugins added.

I'm facing a build issue when I try to use both plugins:

If I use just Local Notifications plugin(Sebastián Katzer), I'm able to compile the project and everything works right but Facebook log-in.
If I use just Facebook* Connect plugin, I'm able to compile the project and everything works right but Local Notifications.

The Build Fail comes when I add both plugins. I've tried with this solution: https://software.intel.com/es-es/node/601005 and didn't worked for me.

I also tried deleting android-support-v4.jar like suggested on h tt p://stacko verflow.c o m/questions/32280539/com-phonegap-plugins-facebookconnect-and-phonegap-plugin-push-not-working-togeth but can't build an apk.

I really appreciate any help you can provide.

-----------------------------------------

Buenos días:

Me encuentro desarrollando una aplicación para Android e iOS con esta herramienta en su versión 2893 y necesito poder iniciar sesión con Facebook y usar notificaciones locales.

Les dejo un repositorio publico con mi proyecto ht tps://bitb ucket.org/RodrigoTunguska/facebooklocalnotification/src/30953916da238c42ff65966d6e9a211b20f8f067?at=default dentro se encuentran unas capturas de pantalla con los plugins utilizados y la pantalla de fallo.

Al momento de agregar el plugin de las notificaciones y probarlo funciona bien salvo el módulo que ocupa Facebook; i.e. Build=> Local Notifications = apk.

Si yo quito ese plugin y agrego el de Facebook funciona bien salvo el módulo de Notificaciones; i.e. Build=> Facebook* Connetc = apk.

Si yo agrgo ambos plugins, al momento de construir la aplicación me manda un error al contruir el apk.

intenté con la solución descrita https://software.intel.com/es-es/node/601005

También intenté con la solución descrita aquí: h tt p://stacko verflow.c o m/questions/32280539/com-phonegap-plugins-facebookconnect-and-phonegap-plugin-push-not-working-togeth y sin resultados

Les agradecería mucho su ayuda.

Tags (2)
0 Kudos
12 Replies
Highlighted
Employee
51 Views

It seems as though there is a conflict that happens when trying to use this two plugin together. According to your build log, the issue is here:

* What went wrong:
Execution failed for task ':dexRelease'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
  	.../android-sdk/build-tools/21.1.2/dx --dex --output .../builds/build.2016-05-18.16-39-16.PqiMk_.tmp/FacebookLocalNotification/platforms/android/build/intermediates/dex/release --input-list=.../builds/build.2016-05-18.16-39-16.PqiMk_.tmp/FacebookLocalNotification/platforms/android/build/intermediates/tmp/dex/release/inputList.txt
  Error Code:
  	2
  Output:
  	
  	UNEXPECTED TOP-LEVEL EXCEPTION:
  	com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
  		at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
  		at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
  		at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
  		at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
  		at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
  		at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
  		at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
  		at com.android.dx.command.dexer.Main.run(Main.java:246)
  		at com.android.dx.command.dexer.Main.main(Main.java:215)
  		at com.android.dx.command.Main.main(Main.java:106)

This is at the Java level and outside of the scope of our support. I recommend reviewing the two plugin's Java files which may reveal that they both at accessing or modifying the same files, premission or configurations.

0 Kudos
Highlighted
Employee
51 Views

Use this facebook plugin instead of the one you are using.

https://github.com/jeduan/cordova-plugin-facebook4

And see if you are able to run this sample app

https://software.intel.com/en-us/xdk/article/facebook-connect-plugin-android-ios

0 Kudos
Highlighted
New Contributor I
51 Views

I'm also having problems adding the facebook plugin. When I add https://github.com/jeduan/cordova-plugin-facebook4 as suggested it wipes out all my other plugins so I only have the facebook one left. I had to restore from a backup to get my project back.

I'm using XDK 2893. 

0 Kudos
Highlighted
51 Views

Gary -- please upgrade to 3357 of the XDK. Version 2893 will be obsolete in a few weeks due to major changes to be implemented in the cloud system. To make the transition easier, use CLI 5.1.1 in 3357 to make sure everything is good, then try moving to 5.4.1 once 5.1.1 in 3357 is stable.

Plugins are handled in a much more secure and reliable way in 3088 and above. 3357 is essentially a bug-fix version of 3088 and 3240 and is, therefore, the best version to be on at this time.

0 Kudos
Highlighted
New Contributor I
51 Views

I've been putting off upgrading because I'm scared my plugins will stop working but maybe now is the time to grasp the nettle.

0 Kudos
Highlighted
51 Views

When switching the CLI version in the build settings, accept the option to ALSO upgrade/downgrade the plugin versions. They tend to work better if you choose the "matching" versions of the plugins.

0 Kudos
Highlighted
New Contributor I
51 Views

Everything builds ok with CLI 5.1.1 but when I switch to 5.4.1 is when I run into problems. A lot of my plugins I have modified and import locally and they won't build with 5.4.1 so I think I'll be sticking with 5.1.1. Any idea on how long .5.1.1 will be supported?

0 Kudos
Highlighted
51 Views

Gary -- at least thru August, not sure if it will stick around after that.

0 Kudos
Highlighted
Beginner
51 Views

Amrita C. (Intel) wrote:

Use this facebook plugin instead of the one you are using.

https://github.com/jeduan/cordova-plugin-facebook4

And see if you are able to run this sample app

https://software.intel.com/en-us/xdk/article/facebook-connect-plugin-and...

I have been trying for days to make facebook login to work in xdk but its becoming a nightmare for me.

Even I try the Facebook demo included in the XDK and it doesn't work. I am using the recently released version xdk 3619. It was asking for a alldevices.mobileprovision file and I created a file in Notepad and saved with that name just to make it to be able to build. So when I install the app in the device and click the "Login with facebook" button nothing happends. Then I modify the login function as follows:

var userId=0;
        var login = function () {
                        
            /*            
            if (window.cordova.platformId == "browser") {
                var appId = "555555555555";// my facebook app Id
                facebookConnectPlugin.browserInit(appId);
                alert(JSON.stringify(facebookConnectPlugin))
            }
            
            facebookConnectPlugin.login( ["email"], 
                function (response) {
                    $("#login_button").hide();
                    $("#user_button").show();
                    $("#logout_button").show();
                userId=response.authResponse.userID; 
                alert("Facebook Login Success")
            },
            function (response) { alert(JSON.stringify(response)) });
            */
            
            facebookConnectPlugin.getLoginStatus(
               function (response) {
                   
                   alert(JSON.stringify(response));
                   
                  if (response.status !== 'connected') {
                     facebookConnectPlugin.login( ["public_profile", "email"],
                        function (response) {
                         
                         alert("0: "+JSON.stringify(response));
                         
                           if (response.status === 'connected') {
                              facebookConnectPlugin.api('/me/?fields=id,name,email', null,
                                 function(response) {
                                    alert("1: "+JSON.stringify(response));
                                 }
                              );
                           }
                        },
                        function (response) { alert("2: "+JSON.stringify(response)); }
                     );
                  } else {
                     facebookConnectPlugin.api('/me/?fields=id,name,email', null,
                        function(response) {
                           alert(JSON.stringify(response));
                        }
                     );
                  }
               },
               function (response) { alert("3: "+JSON.stringify(response)) }
            );
            
        }

And it doesn't show any login dialog window. Instead, a popup window from facebook appears with the Error "Not logged in: You are not logged in. Please login and try again" (see the image below).

 fbError.png .

All the information available in the blogs (including this https://software.intel.com/en-us/xdk/article/facebook-connect-plugin-android-ios) is one year ago and many things changed in both XDK and Facebook and I just can't find the right answers.

Even getting an  App ID in the Facebook site is so confusing since I believe I should select Website App but then it asks for a Site URL which I am not sure if this is necessary or not and is just simply www.myapp.com or I should refer to a php file like www.myapp.com/fblogin.php or something like that.

I really need some guidance, can you please help?

0 Kudos
Highlighted
51 Views

Frungh -

From what I can tell, you are trying to deploy an Android app, however it seems like you are looking for answers to building a web app (which I'm assuming is actually for a website and not an in-app web browser). So the article you linked should actually have all that you need for building the app. Instead of choosing the web app, you should be choosing the Android or iOS app choice. So try grabbing an App ID using the Android as opposed to a web app, and see if that works for you.

 

 

0 Kudos
Highlighted
Beginner
51 Views

Giselle G. (Intel) wrote:

Frungh -

From what I can tell, you are trying to deploy an Android app, however it seems like you are looking for answers to building a web app (which I'm assuming is actually for a website and not an in-app web browser). So the article you linked should actually have all that you need for building the app. Instead of choosing the web app, you should be choosing the Android or iOS app choice. So try grabbing an App ID using the Android as opposed to a web app, and see if that works for you.

 

 

Hello Giselle, thank you for your kind replay. You are correct, I need to choose the Android app choice instead of web app. Finally I made it work. The thing that I was missing seems to be the "Key Hashes". There is no mention about this in Intel example code and I guess that solved my problem. Would be nice if XDK team can make an upgraded demo for Facebook login. Thanks for your response.

0 Kudos
Highlighted