Facebook plugin compilation error

Hello

I’m integrating facebook plugin but when compiling I have this error:
Updated project.properties
Updated local.properties
Updated file /Volumes/untitled/game1/frameworks/runtime-src/proj.android/…/…/…/…/…/…/Users/likon/development/android-sdk-macosx/extras/google/google_play_services/libproject/google-play-services_lib/libs/facebook_lib/proguard-project.txt
Building native…
NDK build mode: release
NDK_TOOLCHAIN_VERSION: 4.8
running: ‘/Users/likon/development/android-ndk-r9d/ndk-build -C /Volumes/untitled/game1/frameworks/runtime-src/proj.android -j8 NDK_MODULE_PATH=/Volumes/untitled/game1/frameworks/runtime-src/proj.android/…/…/js-bindings:/Volumes/untitled/game1/frameworks/runtime-src/proj.android/…/…/js-bindings/cocos2d-x:/Volumes/untitled/game1/frameworks/runtime-src/proj.android/…/…/js-bindings/cocos2d-x/cocos:/Volumes/untitled/game1/frameworks/runtime-src/proj.android/…/…/js-bindings/cocos2d-x/external NDK_TOOLCHAIN_VERSION=4.8’

make: Entering directory /Volumes/untitled/game1/frameworks/runtime-src/proj.android' /Users/likon/development/android-ndk-r9d/build/gmsl/__gmsl:512: *** non-numeric second argument towordlist’ function: ‘15 19’. Stop.
make: Leaving directory `/Volumes/untitled/game1/frameworks/runtime-src/proj.android’
Error running command, return code: 2.game1

Can anyone help?

I found some work around for this but here another problem. I hope one day I will integrate one plugin without spending hours on integration.

[dex] Converting compiled files and external libraries into /Volumes/untitled/game1/frameworks/runtime-src/proj.android/bin/classes.dex…
[dx] Merged dex A (91 defs/88.7KiB) with dex B (1 defs/0.4KiB). Result is 92 defs/104.3KiB. Took 0.1s
[dx] Merged dex A (92 defs/104.3KiB) with dex B (84 defs/107.7KiB). Result is 176 defs/257.7KiB. Took 0.0s
[dx]
[dx] UNEXPECTED TOP-LEVEL EXCEPTION:
[dx] com.android.dex.DexException: Multiple dex files define Lcom/facebook/AccessToken;
[dx] at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
[dx] at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
[dx] at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
[dx] at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
[dx] at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
[dx] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
[dx] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
[dx] at com.android.dx.command.dexer.Main.run(Main.java:277)
[dx] at com.android.dx.command.dexer.Main.main(Main.java:245)
[dx] at com.android.dx.command.Main.main(Main.java:106)
[dx]
[dx] Merged dex A (176 defs/257.7KiB) with dex B (481 defs/547.1KiB). Result is 657 defs/999.8KiB. Took 0.1s

Anyone?

OK I got it working.
SDKBOX Facebook plugin was colliding with cocos2d facebook plugins and jar.
For the weird first error I found some work around.
Anway I think both things should be fixed.

What did you do in order to fix the first problem?

To work around that issue change the line 512 of the file /android-ndk-r8d/build/gmsl/__gmsl to:

int_encode = $(__gmsl_tr1)$(wordlist 1,$(words $1),$(__gmsl_input_int))

BTW I’m still having error on facebook:
08-04 23:24:36.434: E/Parcel(857): Class not found when unmarshalling: com.facebook.login.LoginClient$Request

or:
08-04 23:39:44.550: E/dalvikvm(4209): Could not find class ‘com.facebook.ssl.openssl.TicketEnabledOpenSSLSocketImplWrapper’, referenced from method com.facebook.ssl.openssl.TicketEnabledOpenSSLSocketFactoryHelper.a

also it would be nice to have a full working example of fb usage because I don’t know how to use it
like should I request permission after login or before?
How I can setup callback of login fail/success etc.

console.log("### is logged “+sdkbox.PluginFacebook.isLoggedIn())
if(sdkbox.PluginFacebook.isLoggedIn()){
console.log(”### fb is logged in");
}
else {
console.log("### fb is NOT logged in");
sdkbox.PluginFacebook.setListener({
onLogin: function(isLogin, msg) {
console.log("### fb login");
},
onAPI: function(tag, data) {},
onSharedSuccess: function(data) {},
onSharedFailed: function(data) {},
onSharedCancel: function() {},
onPermission: function(isLogin, msg) {}
});
sdkbox.PluginFacebook.requestReadPermissions([“public_profile”, “email”]);
sdkbox.PluginFacebook.login();
console.log("###" + sdkbox.PluginFacebook.getAccessToken());
}

accessToken is empty even if I can see in logs that it fetch all my data and login with success.
Even when loggin with success I dont have onLogin callback fired
even when loggin with success isLoggedIn returns false.

Please write me some suggestion how to use it because it’s hard to do so.
I’m going to sleep :wink:

Thanks.

Nite can you provide a full example of how to use it? Because as I described it doesn’t behave as expected.

Yes, we’re creating a Facebook sample for you. Can you tell me which version of the cocos2d-x are you using?

I was trying to find in the forum an answer for my question: “why facebook is commented out in js sdkbox samples” and saw your comment. I am using 3.7 and cannot make facebook works.
I would appreciate a working sample. Thank you.

yes Nite, I’m using v3.7 :slight_smile:

I created facebook cpp/js sample, can add that to our sample collections here

Many thanks Nite! I’ll check that in the evening! :slight_smile: