-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin doesn't work on Android #432
Comments
I you use cordova make sure you have the following import:
|
I'm having the same problem. Using the above mentioned imports did not help. Somehow it seems that the Facebook plugin crashes the android-side of cordova libraries; e.g. javascript files are there, but none of their functionality actually works. Build succeeds fine, and I see that cordovalib files are included in there. |
You also have to edit your res/xml/config.xml with the following line:
|
@blaind Does cordova build works in your case? It did not work for me. |
@confile Yes, cordova (well, phonegap, but tried both if it matters) build works: http://pastebin.com/L9GstYGJ and diff to a build without facebook plugin: http://pastebin.com/7rRY0AwV config.xml looks like this (from plugin add)
|
Change
to
@blaind I could not get build to work with facebook plugin. Here are the steps I did
The I open ADT, create new Project > Android from existing source > select two two projects in Test/platforms/android. Right click on Test in ADT. Android > Add Facebook SDK. The in console I did cordova build and get the following error:
Do you have any idea how to solve it? What do you do to make it work? |
I did this to fix the sdk.dir problem:
also, for manually adding the FacebookLib (you don't need to do this if you did it already in eclipse)
|
@blaind Which Facebook SDK do you use? I use facebook-android-sdk-3.8.0 |
@blaind I did
and now I get the following error when doing cordova build:
Do you have any idea on that? |
👍 the android installation is not working for me at all. I tried several different steps and the result is either that I get the errors described above during building process OR i get the Application error (initial comment in this post). Please, has anyone an idea? |
@confile You may have the FacebookLib reference now two times in platforms/android/project.properties @sebastianzillessen I may have found the root cause for this. Does your plugins/android.json contain both "config_munge" => "config.xml" (with facebook stuff) and "config_munge" => "res/xml/config.xml" (other module -definitions) sections? Try merging them to res/xml/config.xml. That helped for me. |
I was able to make it working... These are my steps:
|
@zelphir Did you mean this repo: https://github.com/keab42/phonegap-facebook-plugin I did
After that I do not have a FacebookLib in my lib directory. So I added the FacebookSDK manually in ADT. When I do crdova build I get the following error:
|
Hi, Thanks for you steps but when i want to build I get the following error :
Is it already happened to someone? |
@Kae2312 the same error is happening to me |
I've just managed to fix this same issue. First create a project (or use a existing one) and add th android platform cordova create Test com.example "Test"
cordova platform add android Then you have to install the plugin cordova -d plugin add "C:\Development\phonegap-facebook-plugin-master" --variable APP_ID="xxxxxxxxxxxxxxx" --variable APP_NAME="xxxxxxxxxx" After manually adding the library using eclipse as the README explains, and cleaning the project, close eclipse. It might complain about the path, don't worry it's fine. Here was the main issue, if you tried to compile the project now using "cordova build android" it will fail with mysterious and unrelated error messages. You might find a couple of issues, the first related to a "sdk.dir". What you have to do to solve that is, open plaforms/android/project.properties. Then, make sure the sdk min version is 8 on your application AndroidManifest.xml And finally you have to manually clean the project that eclipse attempted to build. cd platforms/android
ant clean
cd ../../
cordova build android And that's it, those instructions did the trick for me. I spent some time solving this, hope it helps! |
Thank you @fpanettieri ! |
@jtomaszewski it fixed my problem too, eclipse is really adding extra trouble in that story. Maybe the readme should contain the steps without eclipse, just in cli Edit: app crash when calling the .login method E/AndroidRuntime(32685): FATAL EXCEPTION: main |
There is one more thing that I discovered, that might be useful for you to know. I've downloaded and built the Facebook 3.14 SDK, and replaced the FacebookLib reference with the reference to that project. It's a drop-in replacement, it works as expected, with a newer version than the included in current the plugin (3.8 if I recall correctly). There is another catch. When ant attempts to build this dependence, It will fail if you don't remove the folder (at least in Windows): C:\path\to...\facebook-android-sdk-3.14\facebook\bin\res |
Just to tell people know, it finally worked. I just needed to build it with Eclipse (I was doing a cli build) |
@fpanettieri Copying the sdk.dir works! thanks |
when Eclipse build, FB.login() works fine...
UPDATE |
Closing, initial issue has been resolved. |
I have the same problem: I've tried cordova/clean, cordova prepare android and cordova build android, but it didn't help. When I list the classes in FacebookLib/ant-build/classes.jar, there is no R$layout.class, although it exists in the ant-gen directory. |
The reason for the problem is that the android ant scripts exclude R-classes from the library jar file. I can't see why and how the R-files for the facebook lib is supposed to end up in the final apk when using ant (or cordova) build. Manually copying FacebookLib/ant-gen/com to ant-gen/ seems to help. |
@levsa any luck with the |
Copying didn't work, got nullpointerexceptions at runtime. Building with måndag 23 juni 2014 skrev Aaron Forsander notifications@github.com:
|
Hi @levsa, cd platforms/android/FacebookLib
ant release
cd platforms/android/CordovaLib
ant release |
I'm having the same issue as @Stickyhands , @joaoneto and others when running the app.
Building with Eclipse does not seem like a "real" solution, especially considering that this is not mentioned in the README. There has to be a cleaner way of integrating a Cordova app with the Facebook SDK. For now, I'm giving up. May look at using our existing online FB oauth login + InAppBrowser, not ideal but the native SDK plugin is taking up a lot of time and I'm already behind schedule on this particular project. Would love to hear if anyone had any thoughts on the future of Cordova + phonegap-facebook-plugin and this issue :-) |
Best course of action: drop fb integration, it's getting too complicated lately and the gain is getting lower and lower, without cordova in the equation Simple solution: Download ADT, apply the steps, search for this issue tracker to solve the problems ADT process is extremely simple, once you get the hang of it It's really easy to re-apply You can both update the project, or the FacebookSDK and easily re-apply the steps You just have to clean the project you have edited on ADT/Eclipse |
its your plugins solution is rm android platform |
Use this https://github.com/jeduan/cordova-plugin-facebook4 it has all the android sdk problems solved |
Using cordova 3.4.0-0.1.3, Android 4.4.2.
On iOS it is perfect, no problems, not able to make it working on android, I always get an error:
[ERROR] Error initialising Cordova: Class not found
The text was updated successfully, but these errors were encountered: