Module 'facebook' not found

Doing a build with everything that the current documentation requires and still getting the module error on-device.

Could someone advise, please?

I have the FB v4 plugin activated on the plugins page. The documentation Lua matches up with the app code and the config matches exactly. Quadruple checked.

Anything I’ve forgotten from that list?

Fixed. Turns out one of the files in the app was requiring the wrong FB plugin library.

Hi. I m facing the same problem. Can you give more information on how you got it to work, please?

Can you post your build.settings?

Thanks

Rob

Thanks for your quick answer Rob. 

Here is my build.settings. 

– For more information on build.settings see the Corona SDK Build Guide at:

https://docs.coronalabs.com/guide/distribution/buildSettings

settings =

{

plugins = {

[“plugin.facebook.v4”] =

        {

            publisherId = “com.coronalabs”,

            supportedPlatforms = { iphone=true, android=true, [“android-kindle”]=true }

        },

[“plugin.playfab.combo”] = { publisherId = “com.playfab” }

},

orientation =

{

– Supported values for orientation:

– portrait, portraitUpsideDown, landscapeLeft, landscapeRight

default = “portrait”,

supported = { “portrait”, },

},

excludeFiles =

{

– Include only the necessary icon files on each platform

iphone = { “Icon-*dpi.png”, },

android = { “Icon.png”, “Icon-Small-*.png”, “Icon*@2x.png”, },

},

– iOS Section

iphone =

{

plist =

{

UIStatusBarHidden = true,

UIPrerenderedIcon = true, – set to false for “shine” overlay

–UIApplicationExitsOnSuspend = true, – uncomment to quit app on suspend

MinimumOSVersion = “7.0”,

            UIApplicationExitsOnSuspend = false,

            FacebookAppID = “XXXXXXXXXXX”,  – Replace XXXXXXXXXX with your Facebook App ID

            CFBundleURLTypes =

            {

                { CFBundleURLSchemes = { “fbXXXXXXXXXXXX”, } }  – Replace XXXXXXXXXX with your Facebook App ID

            },

            – Whitelist Facebook apps

            LSApplicationQueriesSchemes =

            {

                “fb”,  – Needed for the facebook-v4.isFacebookAppEnabled() API

                “fbapi”,

                “fbauth2”,

                “fb-messenger-api”,

                “fbshareextension”

            },

CFBundleIconFiles =

{

“Icon.png”,

“Icon@2x.png”,

“Icon-167.png”,

“Icon-60.png”,

“Icon-60@2x.png”,

“Icon-60@3x.png”,

“Icon-72.png”,

“Icon-72@2x.png”,

“Icon-76.png”,

“Icon-76@2x.png”,

“Icon-Small.png”,

“Icon-Small@2x.png”,

“Icon-Small@3x.png”,

“Icon-Small-40.png”,

“Icon-Small-40@2x.png”,

“Icon-Small-50.png”,

“Icon-Small-50@2x.png”,

},

},

},

– Android Section

android =

{

facebookAppId = “XXXXXXXXXXXXX”,

usesPermissions =

{

“android.permission.INTERNET”,

},

},

}

Are the settings ok?

Your build.settings seems fine. Can you show where you’re requiring facebook and trying to initialize it.

Rob

The thing is that it doesn’t even load the plugin since the error triggered shows that the plugin is not found.

local composer = require( “composer” )

local widget = require(“widget”)

local scene = composer.newScene()

local json = require (“json”)

local facebook = require( “plugin.facebook.v4” )

local function handleButtonEvent( event )

            if ( “ended” == event.phase ) then

              facebook.login( facebookListener, { “email”, “user_birthday” } )

                print( “Button was pressed and released” )

            end

        end

        local linkFacebook = widget.newButton(

            {

                width = 80,

                height = 80,

                defaultFile = “ButtonsAccount/FBLink.png”,

                overFile = “ButtonsAccount/FBLinkHL.png”,

                onEvent = handleButtonEvent

            }

        )

        – Position the button

        linkFacebook.x = display.contentCenterX / 2

        linkFacebook.y = display.contentCenterY +205

        buttonsGroup : insert(linkFacebook)

Can you post the complete console log showing the error?

Rob

Feb 14 12:50:48.238 [iOS Simulator] Runtime Error: Runtime error: module ‘plugin.facebook.v4’ not found:resource (plugin.facebook.v4.lu) does not exist in archive

Feb 14 12:50:48.238 [iOS Simulator] no field package.preload[‘plugin.facebook.v4’]

                    [iOS Simulator] no file ‘/Users/Zak/Library/Developer/CoreSimulator/Devices/4E4AE563-0480-4E59-A0E2-AC7A371E320F/data/Containers/Bundle/Application/3A8867D8-4BE9-420E-83DE-ADE4FF9C9A54/Cash Treasure.app/plugin/facebook/v4.lua’

                    [iOS Simulator] no file ‘/Users/Zak/Library/Developer/CoreSimulator/Devices/4E4AE563-0480-4E59-A0E2-AC7A371E320F/data/Containers/Bundle/Application/3A8867D8-4BE9-420E-83DE-ADE4FF9C9A54/Cash Treasure.app/plugin/facebook/v4.lua’

                    [iOS Simulator] no file ‘./plugin/facebook/v4.so’

                    [iOS Simulator] no file ‘/Users/Zak/Library/Developer/CoreSimulator/Devices/4E4AE563-0480-4E59-A0E2-AC7A371E320F/data/Containers/Bundle/Application/3A8867D8-4BE9-420E-83DE-ADE4FF9C9A54/Cash Treasure.app/plugin/facebook/v4.so’

                    [iOS Simulator] no file ‘./plugin.so’

                    [iOS Simulator] no file '/Users/Zak/Library/Developer/CoreSimulator/Devices/4E4AE563-0480-4E59-A0E2-AC7A371E320F/data/Containers/Bundle/Application/3A8867D8-4BE9-420E-83DE-ADE4FF9C9A54/Cash Treasure.app/plugin.so’plugin.facebook.v4

                    [iOS Simulator]

                    [iOS Simulator] stack traceback:

                    [iOS Simulator] [C]: in function ‘error’

                    [iOS Simulator] ?: in function ‘gotoScene’

                    [iOS Simulator] principal.lua:171: in function ‘_onEvent’

                    [iOS Simulator] ?: in function ‘?’

                    [iOS Simulator] ?: in function <?:654>

                    [iOS Simulator] ?: in function <?:169>

And what version of Corona are you using?

2016.2992

Take out the supportedPlatforms line in your build.settings. It’s blocking you from accessing the Xcode simulator version of the plugin.

Rob

Thanks Rob!!!

Problem fixed, i can move on on the login process.

Fixed. Turns out one of the files in the app was requiring the wrong FB plugin library.

Hi. I m facing the same problem. Can you give more information on how you got it to work, please?

Can you post your build.settings?

Thanks

Rob

Thanks for your quick answer Rob. 

Here is my build.settings. 

– For more information on build.settings see the Corona SDK Build Guide at:

https://docs.coronalabs.com/guide/distribution/buildSettings

settings =

{

plugins = {

[“plugin.facebook.v4”] =

        {

            publisherId = “com.coronalabs”,

            supportedPlatforms = { iphone=true, android=true, [“android-kindle”]=true }

        },

[“plugin.playfab.combo”] = { publisherId = “com.playfab” }

},

orientation =

{

– Supported values for orientation:

– portrait, portraitUpsideDown, landscapeLeft, landscapeRight

default = “portrait”,

supported = { “portrait”, },

},

excludeFiles =

{

– Include only the necessary icon files on each platform

iphone = { “Icon-*dpi.png”, },

android = { “Icon.png”, “Icon-Small-*.png”, “Icon*@2x.png”, },

},

– iOS Section

iphone =

{

plist =

{

UIStatusBarHidden = true,

UIPrerenderedIcon = true, – set to false for “shine” overlay

–UIApplicationExitsOnSuspend = true, – uncomment to quit app on suspend

MinimumOSVersion = “7.0”,

            UIApplicationExitsOnSuspend = false,

            FacebookAppID = “XXXXXXXXXXX”,  – Replace XXXXXXXXXX with your Facebook App ID

            CFBundleURLTypes =

            {

                { CFBundleURLSchemes = { “fbXXXXXXXXXXXX”, } }  – Replace XXXXXXXXXX with your Facebook App ID

            },

            – Whitelist Facebook apps

            LSApplicationQueriesSchemes =

            {

                “fb”,  – Needed for the facebook-v4.isFacebookAppEnabled() API

                “fbapi”,

                “fbauth2”,

                “fb-messenger-api”,

                “fbshareextension”

            },

CFBundleIconFiles =

{

“Icon.png”,

“Icon@2x.png”,

“Icon-167.png”,

“Icon-60.png”,

“Icon-60@2x.png”,

“Icon-60@3x.png”,

“Icon-72.png”,

“Icon-72@2x.png”,

“Icon-76.png”,

“Icon-76@2x.png”,

“Icon-Small.png”,

“Icon-Small@2x.png”,

“Icon-Small@3x.png”,

“Icon-Small-40.png”,

“Icon-Small-40@2x.png”,

“Icon-Small-50.png”,

“Icon-Small-50@2x.png”,

},

},

},

– Android Section

android =

{

facebookAppId = “XXXXXXXXXXXXX”,

usesPermissions =

{

“android.permission.INTERNET”,

},

},

}

Are the settings ok?

Your build.settings seems fine. Can you show where you’re requiring facebook and trying to initialize it.

Rob