Android Facebook plugin kills app on API call

First, make sure you have something like this in your project.properties:

android.library.reference.2=${CoronaEnterpriseDir}/Plugins/sdk-facebook/android

As for the jar file, I see it in the plugins-specific download…

I’ve tried in 2463 plugins download, but it’s not there. 

I had to download the 2430 package to get it.

Thanks

EDIT:

sorry… I did something weird unpacking the archive. The 2463 indeed has the correct files.

I’m also having problems rebuilding a project with Enterprise.

After adding this line:

android.library.reference.2=${CoronaEnterpriseDir}/Plugins/sdk-facebook/android 

I am now past the facebook error but getting this instead:

/Users/alan/Android/sdk/tools/ant/build.xml:601: The following error occurred while executing this line: /Applications/CoronaEnterprise/Plugins/sdk-facebook/android/build.xml:46: sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var

Since it seemed to want a local.properties file in the facebook plugin folder, I added one.

It then changed the error slightly to this, so again I added a local.properties file.

/Users/alan/Android/sdk/tools/ant/build.xml:601: The following error occurred while executing this line: /Applications/CoronaEnterprise/Corona/android/lib/Corona/build.xml:46: sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var

When I get past that, I get more and more errors… I’m thinking that I’ve made a mistake along the way somewhere.

My project worked with Facebook before, would someone from Corona mind letting me know exactly what changes need to be made to get it up and running again? In this post I’ve seen “you need to add the res files”, “you don’t need to add those files”. dchan also said “he only jar file you need to include from the plugins directory is facebook.jar, all the other ones you don’t need” which makes me wonder why are they there in the first place, perhaps I do need them?

Edit: you also said that “what we need to do is to to download the Facebook SDK and reference it from your project.” Do you mean download it directly from Facebook themselves? Or did you mean the files that are included in the plugins folder?

Hello Alan,

for me, to make it work, I had to actually download the facebook sdk from facebook and reference it just like dchan said.

Just a tip: in project.properties, you have to specify relative path from your project. I’ve tried to put the absolute path and it wouldn’t work. 

Are there any plans to update Corona Enterprise so that it does this automatically? Seems that for most plugins we just use the files that are included in the downloadable plugins folder, would be nice if Facebook was the same.

I still ran into problems, and eventually got round them. I’ll document what I had to do to get a project that had previously worked to work again.

I downloaded the Facebook Android SDK from here: https://developers.facebook.com/docs/android  

I placed it into my Corona Enterprise folder as /Applications/CoronaEnterprise/Plugins/sdk-facebook/android2 and then in my apps project.properties files I have:

target=android-17 android.library.reference.1=${CoronaEnterpriseDir}/Corona/android/lib/Corona android.library.reference.2=${CoronaEnterpriseDir}/Plugins/sdk-facebook/android2

So as far as I know this should now reference the Facebook SDK.

I run build.sh in my project and get this error:

Applications/CoronaEnterprise/Plugins/sdk-facebook/android2 resolve to a path with no project.properties file for project \<my project\>

So I add a project.properties file which matches the original Applications/CoronaEnterprise/Plugins/sdk-facebook/android/project.properties file which comes with Enterprise. I make sure the target is valid and try again:

/Applications/CoronaEnterprise/Plugins/sdk-facebook/android2/AndroidManifest.xml (No such file or directory)

Ok, so I need to add an Android Manifest file. I take the one from the old Facebook folder again and put it into the new SDK folder and try to build again:

BUILD FAILED /Users/alanthomson/Android/sdk/tools/ant/build.xml:601: Invalid file: /Applications/CoronaEnterprise/Plugins/sdk-facebook/android2/build.xml

So there is another file needed, build.xml. I copy that from the old sdk folder to the new one and try again:

/Applications/CoronaEnterprise/Plugins/sdk-facebook/android2/build.xml:46: sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var

So I navigate to the facebook folder, and run:

android update project -p /Applications/CoronaEnterprise/Plugins/sdk-facebook/android2 

and get the following response:

Updated local.properties Added file /Applications/CoronaEnterprise/Plugins/sdk-facebook/android2/proguard-project.txt It seems that there are sub-projects. If you want to update them please use the --subprojects parameter.

All seems good so far. Let’s try again…

BUILD FAILED /Users/alan/Android/sdk/tools/ant/build.xml:601: The following error occurred while executing this line: /Users/alan/Android/sdk/tools/ant/build.xml:653: The following error occurred while executing this line: /Users/alan/Android/sdk/tools/ant/build.xml:659: /Applications/CoronaEnterprise/Plugins/sdk-facebook/android2/src does not exist.

So there is another folder missing. I’ll copy that across from the old project too then. I know get a whole load of errors, so I try copying the contents of the /res folder across too. That seems to get me past those errors, but now I get:

/CoronaEnterprise/Corona/android/lib/Corona/build.xml:46: sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var

That’s odd, I’ve never had that before, and my project built fine in the past. I run this and try again:

android update project -p /Applications/CoronaEnterprise/Corona/android/lib/Corona 

…and at last, I have created life!

It seems like I had to go through quite a lot of trial and error to get the app to build, has anyone else experienced the same issues? And what was the deal with the /Applications/CoronaEnterprise/Corona/android/lib/Corona project suddenly deciding that a file had vanished? 

would anyone be so kind to tell me which files have to be included in the android/libs directory so we don’t have to add the project as a dependency?

This is very frustrating.

So already have the setting in the project.properties and the jar file from corona daily plugins package, what should do more to build successully?

I got error like this:

“xxx/sdk/tools/ant/build.xml:601: Invalid file: /Applications/CoronaEnterprise/Plugins/sdk-facebook/android/build.xml”

So already have the setting in the project.properties and the jar file from corona daily plugins package, what should do more to build successully?

I got error like this:

“xxx/sdk/tools/ant/build.xml:601: Invalid file: /Applications/CoronaEnterprise/Plugins/sdk-facebook/android/build.xml”