Android Facebook plugin kills app on API call

Hi guys, I was trying to do a build using the new refactored android Corona while updating a few libs, and was running into this error:

/AndroidRuntime(13772): FATAL EXCEPTION: main E/AndroidRuntime(13772): java.lang.NoClassDefFoundError: com.facebook.android.R$layout E/AndroidRuntime(13772): at com.facebook.LoginActivity.onCreate(LoginActivity.java:57) E/AndroidRuntime(13772): at android.app.Activity.performCreate(Activity.java:4465) E/AndroidRuntime(13772): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053) E/AndroidRuntime(13772): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934) E/AndroidRuntime(13772): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995) E/AndroidRuntime(13772): at android.app.ActivityThread.access$600(ActivityThread.java:128) E/AndroidRuntime(13772): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161) E/AndroidRuntime(13772): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(13772): at android.os.Looper.loop(Looper.java:137) E/AndroidRuntime(13772): at android.app.ActivityThread.main(ActivityThread.java:4514) E/AndroidRuntime(13772): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(13772): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime(13772): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) E/AndroidRuntime(13772): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) E/AndroidRuntime(13772): at dalvik.system.NativeStart.main(Native Method)

Generally I have assumed that this error is related to my libs directory not being in order, so my guess is that I’m not putting the “resources” folder in the right place. Also, I’m not really sure what to do with that “package.txt” file. Below is my directory listing for the “libs” directory. Any ideas on where these things go, or what is causing the error?

coronaenterprise/projects/wheel/android/libs$ ls -l total 7872 -rw-r--r--@ 1 staff 95546 Jun 20 02:20 AdBuddiz-CoronaPlugin-2.3.3.jar -rw-r--r-- 1 staff 55321 Jul 17 18:07 CoronaProvider.ads.vungle.jar -rw-r--r-- 1 staff 65337 Jul 17 18:07 CoronaProvider.gameNetwork.google.jar -rwxr-xr-x@ 1 staff 1071657 Jun 1 22:12 FlurryAds-4.0.0.jar -rwxr-xr-x@ 1 staff 119077 Jun 1 22:12 FlurryAnalytics-4.0.0.jar -rwxr-xr-x@ 1 staff 242274 May 23 01:11 adcolony.jar -rw-r--r--@ 1 staff 758727 Sep 13 02:00 android-support-v4.jar -rw-r--r--@ 1 staff 46476 Sep 13 02:00 bolts-android-1.1.2.jar -rw-r--r--@ 1 staff 33737 Sep 13 02:00 facebook.jar -rw-r--r--@ 1 staff 514442 Sep 13 02:00 facebook\_sdk.jar -rw-r--r-- 1 staff 13662 Jul 17 18:07 gcm.jar -rw-r--r-- 1 staff 631957 Jul 17 18:07 google-play-services.jar -rw-r--r--@ 1 staff 20 Sep 10 10:21 package.txt -rw-r--r-- 1 staff 157857 Jul 17 18:07 plugin.sponsorpay.jar drwxr-xr-x@ 18 staff 612 Sep 23 15:13 res \*\*(from the FB plugin directory) -rw-r--r-- 1 staff 185088 Jul 17 18:07 vungle-publisher-1.3.11-corona.jar

Also, for reference I have this in my AndroidManifest.xml

 \<activity android:name="com.facebook.LoginActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:configChanges="keyboardHidden|screenSize|orientation"/\> \<activity android:name="facebook.FacebookFragmentActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:configChanges="keyboardHidden|screenSize|orientation"/\>

You need to put everything from the plugin’s res directory into your res directory.  http://developer.android.com/guide/topics/resources/providing-resources.html

Ok, I have done that – same error. Is there anything else needed? (i also deleted the gen/bin directories before building):

jessemanuel@jesses-air:~/coronaenterprise/projects/wheel/android/res$ ls -lrt total 0 drwxr-xr-x@ 3 jessemanuel staff 102 Sep 10 10:21 values-xhdpi drwxr-xr-x@ 3 jessemanuel staff 102 Sep 10 10:21 values-mdpi drwxr-xr-x@ 3 jessemanuel staff 102 Sep 10 10:21 values-ldpi drwxr-xr-x@ 3 jessemanuel staff 102 Sep 10 10:21 values-iw drwxr-xr-x@ 3 jessemanuel staff 102 Sep 10 10:21 values-he drwxr-xr-x@ 3 jessemanuel staff 102 Sep 10 10:21 values-hdpi drwxr-xr-x@ 3 jessemanuel staff 102 Sep 10 10:21 values-es drwxr-xr-x@ 7 jessemanuel staff 238 Sep 10 10:21 values drwxr-xr-x@ 33 jessemanuel staff 1122 Sep 10 10:21 drawable drwxr-xr-x@ 17 jessemanuel staff 578 Sep 13 02:00 layout drwxr-xr-x@ 21 jessemanuel staff 714 Sep 24 10:56 drawable-xhdpi drwxr-xr-x@ 16 jessemanuel staff 544 Sep 24 10:56 drawable-mdpi drwxr-xr-x@ 4 jessemanuel staff 136 Sep 24 10:56 drawable-ldpi drwxr-xr-x@ 21 jessemanuel staff 714 Sep 24 10:56 drawable-hdpi

and as an example, here is the ‘layout’ directory:

jessemanuel@jesses-air:~/coronaenterprise/projects/wheel/android/res/layout$ ls -lrt total 120 -rw-r--r--@ 1 jessemanuel staff 2235 Sep 10 10:21 com\_facebook\_tooltip\_bubble.xml -rw-r--r--@ 1 jessemanuel staff 3971 Sep 10 10:21 com\_facebook\_placepickerfragment\_list\_row.xml -rw-r--r--@ 1 jessemanuel staff 1947 Sep 10 10:21 com\_facebook\_placepickerfragment.xml -rw-r--r--@ 1 jessemanuel staff 1024 Sep 10 10:21 com\_facebook\_picker\_title\_bar\_stub.xml -rw-r--r--@ 1 jessemanuel staff 2647 Sep 10 10:21 com\_facebook\_picker\_title\_bar.xml -rw-r--r--@ 1 jessemanuel staff 1192 Sep 10 10:21 com\_facebook\_picker\_search\_box.xml -rw-r--r--@ 1 jessemanuel staff 1290 Sep 10 10:21 com\_facebook\_picker\_list\_section\_header.xml -rw-r--r--@ 1 jessemanuel staff 1951 Sep 10 10:21 com\_facebook\_picker\_list\_row.xml -rw-r--r--@ 1 jessemanuel staff 945 Sep 10 10:21 com\_facebook\_picker\_image.xml -rw-r--r--@ 1 jessemanuel staff 957 Sep 10 10:21 com\_facebook\_picker\_checkbox.xml -rw-r--r--@ 1 jessemanuel staff 1289 Sep 10 10:21 com\_facebook\_picker\_activity\_circle\_row.xml -rw-r--r--@ 1 jessemanuel staff 618 Sep 10 10:21 com\_facebook\_login\_activity\_layout.xml -rw-r--r--@ 1 jessemanuel staff 1813 Sep 10 10:21 com\_facebook\_friendpickerfragment.xml -rw-r--r--@ 1 jessemanuel staff 2451 Sep 13 02:00 com\_facebook\_usersettingsfragment.xml -rw-r--r--@ 1 jessemanuel staff 1310 Sep 13 02:00 com\_facebook\_search\_bar\_layout.xml

More info: I tried running it through the ProjectTemplate from the latest build (App), and came up with the same issue. For reference, the main.lua looks like :

facebook = require "facebook" require ("debug-utils") --require ("facebook-utils") --require ("general-utils") timer.performWithDelay( 2000, function() dump("\*\*\*\*\*\*\*\*\*\*\* Facebook Test") -- listener for "fbconnect" events local function listener( event ) if ( "session" == event.type ) then -- upon successful login, request list of friends if ( "login" == event.phase ) then facebook.showDialog( "apprequests", { message="You should download this game!" } ) end elseif ( "dialog" == event.type ) then print( event.response ) end end -- first argument is the app id that you get from Facebook facebook.login( "2549807942717", listener ) --replace XXXXXXXXXX with your Facebook App ID end)

I am getting this error – I noticed the top part. Any relevance? (i do have the INTERNET permission in my android manifest, btw):

V/Corona ( 1761): \> Class.forName: facebook.LuaLoader V/Corona ( 1761): \< Class.forName: facebook.LuaLoader V/Corona ( 1761): Loading via reflection: facebook.LuaLoader E/AlarmManagerService( 185): android\_server\_AlarmManagerService\_set to type=2, 1140357.704000000 E/AlarmManagerService( 185): android\_server\_AlarmManagerService\_set to type=3, 1140344.070000000 W/NetworkStats( 185): found non-monotonic values; saving to dropbox D/dalvikvm( 185): GC\_CONCURRENT freed 1835K, 41% free 18585K/31047K, paused 4ms+13ms E/lights ( 185): write\_int failed to open /sys/class/sec/sec\_touchkey/brightness W/PowerManagerService( 185): Timer 0x7-\>0x3|0x0 I/PowerManagerService( 185): Ulight 7-\>3|0 D/PowerManagerService( 185): setLightBrightness : mButtonLight : 0 D/PowerManagerService( 185): lightSensorChangedLocked 563 D/PowerManagerService( 185): lcdValue 140 D/PowerManagerService( 185): buttonValue 0 D/PowerManagerService( 185): keyboardValue 0 D/PowerManagerService( 185): lightSensorChangedLocked : mKeyboardLight : 0 I/Corona ( 1761): \*\*\*\*\*\*\*\*\*\*\* Facebook Test W/dalvikvm( 1761): VFY: unable to resolve static field 3990 (com\_facebook\_internet\_permission\_error\_title) in Lcom/facebook/android/R$string; D/dalvikvm( 1761): VFY: replacing opcode 0x60 at 0x0010 I/dalvikvm( 1761): DexOpt: unable to optimize static field ref 0x0f95 at 0x18 in Lcom/facebook/AuthorizationClient;.checkInternetPermission W/dalvikvm( 1761): VFY: unable to resolve static field 3979 (com\_facebook\_login\_activity\_layout) in Lcom/facebook/android/R$layout; D/dalvikvm( 1761): VFY: replacing opcode 0x60 at 0x0003 W/dalvikvm( 1761): VFY: unable to resolve static field 3959 (com\_facebook\_login\_activity\_progress\_bar) in Lcom/facebook/android/R$id; D/dalvikvm( 1761): VFY: replacing opcode 0x60 at 0x0008 I/ActivityManager( 185): START {intent.toShortString} from pid 1761 I/power ( 185): \*\*\* acquire\_dvfs\_lock : lockType : 1 freq : 1008000 D/PowerManagerService( 185): acquireDVFSLockLocked : type : DVFS\_MIN\_LIMIT frequency : 1008000 uid : 1000 pid : 185 tag : ActivityManager W/ActivityManager( 185): mDVFSLock.acquire() D/SensorManager( 1761): unregisterListener:: disable all sensors for this listener, name = BMA254 Acceleration Sensor listener = android.view.OrientationEventListener$SensorEventListenerImpl@4123d220 D/ActivityManager( 185): Trying to launch applicationName V/WindowManager( 185): rotationForOrientationLw(orient=-1, last=3); user=0 mLidOpen=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=1 sensorRotation=-1 D/AndroidRuntime( 1761): Shutting down VM W/dalvikvm( 1761): threadid=1: thread exiting with uncaught exception (group=0x40b9b1f8) E/AndroidRuntime( 1761): FATAL EXCEPTION: main E/AndroidRuntime( 1761): java.lang.NoClassDefFoundError: com.facebook.android.R$layout E/AndroidRuntime( 1761): at com.facebook.LoginActivity.onCreate(LoginActivity.java:57) E/AndroidRuntime( 1761): at android.app.Activity.performCreate(Activity.java:4465) E/AndroidRuntime( 1761): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053) E/AndroidRuntime( 1761): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934) E/AndroidRuntime( 1761): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995) E/AndroidRuntime( 1761): at android.app.ActivityThread.access$600(ActivityThread.java:128) E/AndroidRuntime( 1761): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161) E/AndroidRuntime( 1761): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime( 1761): at android.os.Looper.loop(Looper.java:137) E/AndroidRuntime( 1761): at android.app.ActivityThread.main(ActivityThread.java:4514) E/AndroidRuntime( 1761): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 1761): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime( 1761): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) E/AndroidRuntime( 1761): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) E/AndroidRuntime( 1761): at dalvik.system.NativeStart.main(Native Method) E/android.os.Debug( 185): !@Dumpstate \> dumpstate -k -t -n -z -d -o /data/log/dumpstate\_app\_error W/ActivityManager( 185): Force finishing activity com.jerichogames.sample/com.facebook.LoginActivity W/ActivityManager( 185): Force finishing activity com.jerichogames.sample/com.ansca.corona.CoronaActivity I/dumpstate( 1791): begin W/ActivityManager( 185): Activity pause timeout for ActivityRecord{413e54f0 com.jerichogames.sample/com.facebook.LoginActivity} D/PowerManagerService( 185): lightSensorChangedLocked 575 D/PowerManagerService( 185): lcdValue 140 D/PowerManagerService( 185): buttonValue 0 D/PowerManagerService( 185): keyboardValue 0 D/PowerManagerService( 185): lightSensorChangedLocked : mKeyboardLight : 0 E/Watchdog( 185): !@Sync 16035 D/PowerManagerService( 185): lightSensorChangedLocked 588 D/PowerManagerService( 185): lcdValue 140 D/PowerManagerService( 185): buttonValue 0 D/PowerManagerService( 185): keyboardValue 0 D/PowerManagerService( 185): lightSensorChangedLocked : mKeyboardLight : 0 D/VoldCmdListener( 87): asec list D/VoldCmdListener( 87): CommandListener::AsecCmd::runCommand -\> -- D/DEFERED\_APP\_VISIBILITY( 185): tweaking closing app D/DEFERED\_APP\_VISIBILITY( 185): tweaking closing app

Sorry my earlier post was incorrect.  What you actually need to do is to to download the Facebook SDK and reference it from your project.  http://developer.android.com/tools/projects/projects-cmdline.html#ReferencingLibraryProject.  The only jar file you need to include from the plugins directory is facebook.jar, all the other ones you don’t need.  You also don’t need to add the res files. 

Great. That worked - thank you

Where did you get the facebook.jar from?

I can’t see it in the most recent plugins package nor in the corona enterprise core.

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&nbsp;

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.

You need to put everything from the plugin’s res directory into your res directory.  http://developer.android.com/guide/topics/resources/providing-resources.html

Ok, I have done that – same error. Is there anything else needed? (i also deleted the gen/bin directories before building):

jessemanuel@jesses-air:~/coronaenterprise/projects/wheel/android/res$ ls -lrt total 0 drwxr-xr-x@ 3 jessemanuel staff 102 Sep 10 10:21 values-xhdpi drwxr-xr-x@ 3 jessemanuel staff 102 Sep 10 10:21 values-mdpi drwxr-xr-x@ 3 jessemanuel staff 102 Sep 10 10:21 values-ldpi drwxr-xr-x@ 3 jessemanuel staff 102 Sep 10 10:21 values-iw drwxr-xr-x@ 3 jessemanuel staff 102 Sep 10 10:21 values-he drwxr-xr-x@ 3 jessemanuel staff 102 Sep 10 10:21 values-hdpi drwxr-xr-x@ 3 jessemanuel staff 102 Sep 10 10:21 values-es drwxr-xr-x@ 7 jessemanuel staff 238 Sep 10 10:21 values drwxr-xr-x@ 33 jessemanuel staff 1122 Sep 10 10:21 drawable drwxr-xr-x@ 17 jessemanuel staff 578 Sep 13 02:00 layout drwxr-xr-x@ 21 jessemanuel staff 714 Sep 24 10:56 drawable-xhdpi drwxr-xr-x@ 16 jessemanuel staff 544 Sep 24 10:56 drawable-mdpi drwxr-xr-x@ 4 jessemanuel staff 136 Sep 24 10:56 drawable-ldpi drwxr-xr-x@ 21 jessemanuel staff 714 Sep 24 10:56 drawable-hdpi

and as an example, here is the ‘layout’ directory:

jessemanuel@jesses-air:~/coronaenterprise/projects/wheel/android/res/layout$ ls -lrt total 120 -rw-r--r--@ 1 jessemanuel staff 2235 Sep 10 10:21 com\_facebook\_tooltip\_bubble.xml -rw-r--r--@ 1 jessemanuel staff 3971 Sep 10 10:21 com\_facebook\_placepickerfragment\_list\_row.xml -rw-r--r--@ 1 jessemanuel staff 1947 Sep 10 10:21 com\_facebook\_placepickerfragment.xml -rw-r--r--@ 1 jessemanuel staff 1024 Sep 10 10:21 com\_facebook\_picker\_title\_bar\_stub.xml -rw-r--r--@ 1 jessemanuel staff 2647 Sep 10 10:21 com\_facebook\_picker\_title\_bar.xml -rw-r--r--@ 1 jessemanuel staff 1192 Sep 10 10:21 com\_facebook\_picker\_search\_box.xml -rw-r--r--@ 1 jessemanuel staff 1290 Sep 10 10:21 com\_facebook\_picker\_list\_section\_header.xml -rw-r--r--@ 1 jessemanuel staff 1951 Sep 10 10:21 com\_facebook\_picker\_list\_row.xml -rw-r--r--@ 1 jessemanuel staff 945 Sep 10 10:21 com\_facebook\_picker\_image.xml -rw-r--r--@ 1 jessemanuel staff 957 Sep 10 10:21 com\_facebook\_picker\_checkbox.xml -rw-r--r--@ 1 jessemanuel staff 1289 Sep 10 10:21 com\_facebook\_picker\_activity\_circle\_row.xml -rw-r--r--@ 1 jessemanuel staff 618 Sep 10 10:21 com\_facebook\_login\_activity\_layout.xml -rw-r--r--@ 1 jessemanuel staff 1813 Sep 10 10:21 com\_facebook\_friendpickerfragment.xml -rw-r--r--@ 1 jessemanuel staff 2451 Sep 13 02:00 com\_facebook\_usersettingsfragment.xml -rw-r--r--@ 1 jessemanuel staff 1310 Sep 13 02:00 com\_facebook\_search\_bar\_layout.xml

More info: I tried running it through the ProjectTemplate from the latest build (App), and came up with the same issue. For reference, the main.lua looks like :

facebook = require "facebook" require ("debug-utils") --require ("facebook-utils") --require ("general-utils") timer.performWithDelay( 2000, function() dump("\*\*\*\*\*\*\*\*\*\*\* Facebook Test") -- listener for "fbconnect" events local function listener( event ) if ( "session" == event.type ) then -- upon successful login, request list of friends if ( "login" == event.phase ) then facebook.showDialog( "apprequests", { message="You should download this game!" } ) end elseif ( "dialog" == event.type ) then print( event.response ) end end -- first argument is the app id that you get from Facebook facebook.login( "2549807942717", listener ) --replace XXXXXXXXXX with your Facebook App ID end)

I am getting this error – I noticed the top part. Any relevance? (i do have the INTERNET permission in my android manifest, btw):

V/Corona ( 1761): \> Class.forName: facebook.LuaLoader V/Corona ( 1761): \< Class.forName: facebook.LuaLoader V/Corona ( 1761): Loading via reflection: facebook.LuaLoader E/AlarmManagerService( 185): android\_server\_AlarmManagerService\_set to type=2, 1140357.704000000 E/AlarmManagerService( 185): android\_server\_AlarmManagerService\_set to type=3, 1140344.070000000 W/NetworkStats( 185): found non-monotonic values; saving to dropbox D/dalvikvm( 185): GC\_CONCURRENT freed 1835K, 41% free 18585K/31047K, paused 4ms+13ms E/lights ( 185): write\_int failed to open /sys/class/sec/sec\_touchkey/brightness W/PowerManagerService( 185): Timer 0x7-\>0x3|0x0 I/PowerManagerService( 185): Ulight 7-\>3|0 D/PowerManagerService( 185): setLightBrightness : mButtonLight : 0 D/PowerManagerService( 185): lightSensorChangedLocked 563 D/PowerManagerService( 185): lcdValue 140 D/PowerManagerService( 185): buttonValue 0 D/PowerManagerService( 185): keyboardValue 0 D/PowerManagerService( 185): lightSensorChangedLocked : mKeyboardLight : 0 I/Corona ( 1761): \*\*\*\*\*\*\*\*\*\*\* Facebook Test W/dalvikvm( 1761): VFY: unable to resolve static field 3990 (com\_facebook\_internet\_permission\_error\_title) in Lcom/facebook/android/R$string; D/dalvikvm( 1761): VFY: replacing opcode 0x60 at 0x0010 I/dalvikvm( 1761): DexOpt: unable to optimize static field ref 0x0f95 at 0x18 in Lcom/facebook/AuthorizationClient;.checkInternetPermission W/dalvikvm( 1761): VFY: unable to resolve static field 3979 (com\_facebook\_login\_activity\_layout) in Lcom/facebook/android/R$layout; D/dalvikvm( 1761): VFY: replacing opcode 0x60 at 0x0003 W/dalvikvm( 1761): VFY: unable to resolve static field 3959 (com\_facebook\_login\_activity\_progress\_bar) in Lcom/facebook/android/R$id; D/dalvikvm( 1761): VFY: replacing opcode 0x60 at 0x0008 I/ActivityManager( 185): START {intent.toShortString} from pid 1761 I/power ( 185): \*\*\* acquire\_dvfs\_lock : lockType : 1 freq : 1008000 D/PowerManagerService( 185): acquireDVFSLockLocked : type : DVFS\_MIN\_LIMIT frequency : 1008000 uid : 1000 pid : 185 tag : ActivityManager W/ActivityManager( 185): mDVFSLock.acquire() D/SensorManager( 1761): unregisterListener:: disable all sensors for this listener, name = BMA254 Acceleration Sensor listener = android.view.OrientationEventListener$SensorEventListenerImpl@4123d220 D/ActivityManager( 185): Trying to launch applicationName V/WindowManager( 185): rotationForOrientationLw(orient=-1, last=3); user=0 mLidOpen=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=1 sensorRotation=-1 D/AndroidRuntime( 1761): Shutting down VM W/dalvikvm( 1761): threadid=1: thread exiting with uncaught exception (group=0x40b9b1f8) E/AndroidRuntime( 1761): FATAL EXCEPTION: main E/AndroidRuntime( 1761): java.lang.NoClassDefFoundError: com.facebook.android.R$layout E/AndroidRuntime( 1761): at com.facebook.LoginActivity.onCreate(LoginActivity.java:57) E/AndroidRuntime( 1761): at android.app.Activity.performCreate(Activity.java:4465) E/AndroidRuntime( 1761): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053) E/AndroidRuntime( 1761): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934) E/AndroidRuntime( 1761): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995) E/AndroidRuntime( 1761): at android.app.ActivityThread.access$600(ActivityThread.java:128) E/AndroidRuntime( 1761): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161) E/AndroidRuntime( 1761): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime( 1761): at android.os.Looper.loop(Looper.java:137) E/AndroidRuntime( 1761): at android.app.ActivityThread.main(ActivityThread.java:4514) E/AndroidRuntime( 1761): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 1761): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime( 1761): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) E/AndroidRuntime( 1761): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) E/AndroidRuntime( 1761): at dalvik.system.NativeStart.main(Native Method) E/android.os.Debug( 185): !@Dumpstate \> dumpstate -k -t -n -z -d -o /data/log/dumpstate\_app\_error W/ActivityManager( 185): Force finishing activity com.jerichogames.sample/com.facebook.LoginActivity W/ActivityManager( 185): Force finishing activity com.jerichogames.sample/com.ansca.corona.CoronaActivity I/dumpstate( 1791): begin W/ActivityManager( 185): Activity pause timeout for ActivityRecord{413e54f0 com.jerichogames.sample/com.facebook.LoginActivity} D/PowerManagerService( 185): lightSensorChangedLocked 575 D/PowerManagerService( 185): lcdValue 140 D/PowerManagerService( 185): buttonValue 0 D/PowerManagerService( 185): keyboardValue 0 D/PowerManagerService( 185): lightSensorChangedLocked : mKeyboardLight : 0 E/Watchdog( 185): !@Sync 16035 D/PowerManagerService( 185): lightSensorChangedLocked 588 D/PowerManagerService( 185): lcdValue 140 D/PowerManagerService( 185): buttonValue 0 D/PowerManagerService( 185): keyboardValue 0 D/PowerManagerService( 185): lightSensorChangedLocked : mKeyboardLight : 0 D/VoldCmdListener( 87): asec list D/VoldCmdListener( 87): CommandListener::AsecCmd::runCommand -\> -- D/DEFERED\_APP\_VISIBILITY( 185): tweaking closing app D/DEFERED\_APP\_VISIBILITY( 185): tweaking closing app

Sorry my earlier post was incorrect.  What you actually need to do is to to download the Facebook SDK and reference it from your project.  http://developer.android.com/tools/projects/projects-cmdline.html#ReferencingLibraryProject.  The only jar file you need to include from the plugins directory is facebook.jar, all the other ones you don’t need.  You also don’t need to add the res files. 

Great. That worked - thank you

Where did you get the facebook.jar from?

I can’t see it in the most recent plugins package nor in the corona enterprise core.