Getting code error 5 when trying to build Android apk

Hi,

For some reason, I’m getting this error:

ERROR: An error occurred during build. The server returned the following message:

A device build error occurred on the server.

Error: Error packaging APK. Potential conflict between resources or plugins.

BuildID: 573bf8fae6db0

May 18 05:10:06.250 Android build failed (5)

May 18 05:10:06.588 ERROR: Build Failed: Error code: 5

May 18 05:11:25.701 [RevMob] Invalid App Id: nil

 

What it could be the reason of the potential conflict? I am getting it after I put the Facebook v4 plugin.

Can you post your build.settings file please?

Also your code for setting up RevMob?

Thanks

Rob

Hi Rob, thank you for your fast reply. I must added wrongly or removed something that I wasn’t supposed to, I can’t run it anymore, now it says:

Error loading module ‘setupFile’ from file ‘/Users/Snakewar/Desktop/Flying Aliens/code/setupFile.lua’:

/Users/Snakewar/Desktop/Flying Aliens/code/setupFile.lua:19: unexpected symbol near ‘‚’

File: error loading module ‘setupFile’ from file ‘setupFile.lua’

stack traceback:

C: in function ‘require’

?: in function ‘require’

main.lua:10: in main chunk

 

The code of setupFile.lua is:

--CHECK adsLib.lua TO ADD YOUR ADS KEYS --CHECK build.settings TO FINALIZE SHARE/ADS --CHECK gameScene.lua TO CHANGE OTHER PARAMETERS RELATED TO THE GAME local ragdogLib = require "ragdogLib"; local adsLib = require "adsLib"; local networksLib = require "networksLib"; local totalWidth = \_G.totalWidth; local totalHeight = \_G.totalHeight; local leftSide = \_G.leftSide; local rightSide = \_G.rightSide; local topSide = \_G.topSide; local bottomSide = \_G.bottomSide; local centerX = display.contentCenterX; local centerY = display.contentCenterY; local layersWidth = math.max(512, totalWidth); \_G.activateInAppPurchase = true; \_G.iApItems = { [“250Coins"] = {"com.denwatech.100coins"}, [“500Coins"] = {"com.denwatech.500coins"}, [“1000Coins"] = {"com.denwatech.1000coins"}, ["removeAds"] = {"com.denwatech.removeAds”}, }; \_G.activeRemoveAdsButton = true; \_G.activateCharacterSelect = true; \_G.showInGameCurrency = true; \_G.totalCoins = ragdogLib.getSaveValue("coins") or 0; \_G.twitterConsumerKey = "zTOwTDWojSfMXSXK7RmpX3zmj"; \_G.twitterSecretKey = "i0Twy92iQbFg5d0aEHh1NcaPAWG3GiMMPpPmKjOaJ5HOgnwN7O"; \_G.facebookAPPID = "116596392089785"; \_G.socialShareMessage = "I just made totalPoints in Flying Aliens"; \_G.imageForSocialPluginShare = "Icon.png"; \_G.useSocialPlugin = true; --here we setup the data for the characters. You need to put the name for that character, the path for the spritesheet of that character, --width/height of the spritesheet, number of frames in the sheet, width/height of a single frame within the spritesheet, the path for the image that will appear in the selection screen, width/height of that image, if it's locked or not by default --and cost in in-game coins in case it's locked. --you can add as many characters as you want \_G.characterData = { [1] = { "Bird 1", "IMG/birdSheet.png", 150, 38, 3, 50, 38, "IMG/birdPortrait1.png", 43, 31, false }, [2] = { "Bird 2", "IMG/birdSheet2.png", 150, 38, 3, 50, 38, "IMG/birdPortrait2.png", 43, 31, true, 300 }, }; \_G.characterAnimation = { ["Bird 1"] = { {name = "flap", frames = {1, 2, 3, 2}, time = 400, loopCount = 0}, {name = "death", frames = {2}, time = 200, loopCount = 0}, }, ["Bird 2"] = { {name = "flap", frames = {1, 2, 3, 2}, time = 400, loopCount = 0}, {name = "death", frames = {2}, time = 200, loopCount = 0}, }, }; for i = 1, #\_G.characterData do if \_G.characterData[i][11] then if ragdogLib.getSaveValue(\_G.characterData[i][1]) then \_G.characterData[i][11] = false; if not \_G.chosenCharacter then \_G.chosenCharacter = \_G.characterData[i]; end end else if not \_G.chosenCharacter then \_G.chosenCharacter = \_G.characterData[i]; end end end --And here we can set our backgrounds. They're made up of 5 layers plus the pipes. --You can add infinite numbers of backgrounds. --Where present, the 4th number after path, width and height indicates the offset Y to position that layer relative to the ground. \_G.backgroundsData = { [1] = { sky = {"IMG/bg.png", totalWidth, totalHeight}, ground = {"IMG/ground.png", layersWidth, 124}, city = {"IMG/skyline.png", layersWidth, 64, -30}, bushes = {"IMG/grass.png", layersWidth, 52, -5}, clouds = {"IMG/clouds.png", layersWidth, 112, -40}, pipes = {"IMG/tube.png", 60, 512} }, [2] = { sky = {"IMG/bg2.png", totalWidth, totalHeight}, ground = {"IMG/ground2.png", layersWidth, 124}, city = {"IMG/skyline2.png", layersWidth, 64, -30}, bushes = {"IMG/grass2.png", layersWidth, 52, -5}, clouds = {"IMG/clouds2.png", layersWidth, 112, -40}, pipes = {"IMG/tube.png", 60, 512} } }; local activeNetworksProviders = { ["Android"] = {"google", "YOUR LEADERBOARD ID"}, --replace "google" with "none" if you don't use any leaderboard! ["iPhone OS"] = {"gamecenter", "YOUR LEADERBOARD ID"} --replace "gamecenter" with "none" if you don't use any leaderboard! }; local function systemEvents( event ) if ( event.type == "applicationSuspend" ) then elseif ( event.type == "applicationResume" ) then elseif ( event.type == "applicationExit" ) then elseif ( event.type == "applicationStart" ) then networksLib.init(activeNetworksProviders); end return true end Runtime:addEventListener( "system", systemEvents ) --CHECK TUTORIAL ON HOW TO SET ADS UP HERE http://ragdogstudios.com/2014/08/23/adslib-v2-how-to-implement-it-and-maximize-your-revenues/ local adsSettings = { ["iPhone"] = { ["game\_over"] = { mediationType = "order", adType = "interstitial", frequency = 1, keepOrderDuringSession = true, providers = { [1] = { providerName = "chartboost", providerFallback = 2, mustBeCached = true, }, [2] = { providerName = "revmob", providerFallback = 1, mustBeCached = false } } }, ["during\_game"] = { mediationType = "order", adType = "banner", frequency = 1, adPosition = "top", keepOrderDuringSession = true, providers = { [1] = { providerName = "revmob", providerFallback = nil } } } }, ["Android"] = { ["game\_over"] = { mediationType = "order", adType = "interstitial", frequency = 1, keepOrderDuringSession = true, providers = { [1] = { providerName = "chartboost", providerFallback = 2, mustBeCached = true, }, [2] = { providerName = "revmob", providerFallback = 1, mustBeCached = false } } }, ["during\_game"] = { mediationType = "order", adType = "banner", frequency = 1, adPosition = "top", keepOrderDuringSession = true, providers = { [1] = { providerName = "revmob", providerFallback = nil } } } } }; local activeAdsProviders = { ["Android"] = {"revmob", "chartboost"}, -- possible values are "tapfortap", "admob", "playhaven", "revmob", "chartboost", "iads" ["iPhone"] = {"revmob", "chartboost"} --it should include all the ads providers you've put in the adsSettings table }; adsLib.init(activeAdsProviders, adsSettings);

And for main.lua is

display.setStatusBar(display.HiddenStatusBar); \_G.totalWidth = display.contentWidth-(display.screenOriginX\*2); \_G.totalHeight = display.contentHeight-(display.screenOriginY\*2); \_G.leftSide = display.screenOriginX; \_G.rightSide = display.contentWidth-display.screenOriginX; \_G.topSide = display.screenOriginY; \_G.bottomSide = display.contentHeight-display.screenOriginY; local setupFile = require "setupFile"; local facebook = require( "plugin.facebook.v4" ) local fpsLib = require "fpsLib"; local composer = require "composer"; composer.recycleOnSceneChange = true; fpsLib.init(); \_G.buttonSFX = audio.loadSound("SFX/wooshSFX.mp3"); local totalWidth = \_G.totalWidth; --I localize this because it'll be used intesively here; local originX = display.screenOriginX --we're gonna need this as well; --we put the creation of the level parallax effect here, since we're going to use that in most scenes \_G.createParallaxBackground = function(group, bgData) --let's hold a single width for all the layers, to help support multi devices and improve performances local layersWidth = math.max(512, totalWidth); --layer for the ground local activeGround, inactiveGround, groundLayer1, groundLayer2; groundLayer1 = display.newImageRect(group, bgData.ground[1], bgData.ground[2], bgData.ground[3]); groundLayer1.x, groundLayer1.y = display.contentCenterX, display.contentHeight; groundLayer2 = display.newImageRect(group, bgData.ground[1], bgData.ground[2], bgData.ground[3]); groundLayer2.x, groundLayer2.y = groundLayer1.x+layersWidth, groundLayer1.y; activeGround = groundLayer1; inactiveGround = groundLayer2; --layer with the clouds local activeClouds, inactiveClouds, cloudsLayer1, cloudsLayer2; cloudsLayer1 = display.newImageRect(group, bgData.clouds[1], bgData.clouds[2], bgData.clouds[3]); cloudsLayer1.x, cloudsLayer1.y = groundLayer1.x, groundLayer1.contentBounds.yMin+bgData.clouds[4]; cloudsLayer2 = display.newImageRect(group, bgData.clouds[1], bgData.clouds[2], bgData.clouds[3]); cloudsLayer2.x, cloudsLayer2.y = cloudsLayer1.x+layersWidth, cloudsLayer1.y; activeClouds = cloudsLayer1; inactiveClouds = cloudsLayer2; --layer for the city local activeCity, inactiveCity, cityLayer1, cityLayer2; cityLayer1 = display.newImageRect(group, bgData.city[1], bgData.city[2], bgData.city[3]); cityLayer1.x, cityLayer1.y = groundLayer1.x, groundLayer1.contentBounds.yMin+bgData.city[4]; cityLayer2 = display.newImageRect(group, bgData.city[1], bgData.city[2], bgData.city[3]); cityLayer2.x, cityLayer2.y = cityLayer1.x+layersWidth, cityLayer1.y; activeCity = cityLayer1; inactiveCity = cityLayer2; --layer for the bushes local activeBush, inactiveBush, bushLayer1, bushLayer1; bushLayer1 = display.newImageRect(group, bgData.bushes[1], bgData.bushes[2], bgData.bushes[3]); bushLayer1.x, bushLayer1.y = groundLayer1.x, groundLayer1.contentBounds.yMin+bgData.bushes[4]; bushLayer2 = display.newImageRect(group, bgData.bushes[1], bgData.bushes[2], bgData.bushes[3]); bushLayer2.x, bushLayer2.y = bushLayer1.x+layersWidth, bushLayer1.y; activeBush = bushLayer1; inactiveBush = bushLayer2; --we create our game layer here, so that pipes and birds will be below the ground but over the background local gameLayer = display.newGroup(); group:insert(gameLayer); group:insert(groundLayer1); group:insert(groundLayer2); function groundLayer1:enterFrame() if not group.paused then local gameSpeed = group.gameSpeed; local groundPosition = activeGround.x; groundPosition = groundPosition-gameSpeed; activeGround.x = groundPosition; inactiveGround.x = groundPosition+layersWidth; if groundPosition+layersWidth\*.5 \<= originX then activeGround, inactiveGround = inactiveGround, activeGround; end local cloudPosition = activeClouds.x; cloudPosition = cloudPosition-gameSpeed\*.1; activeClouds.x = cloudPosition; inactiveClouds.x = cloudPosition+layersWidth; if cloudPosition+layersWidth\*.5 \<= originX then activeClouds, inactiveClouds = inactiveClouds, activeClouds; end local cityPosition = activeCity.x; cityPosition = cityPosition-gameSpeed\*.2; activeCity.x = cityPosition; inactiveCity.x = cityPosition+layersWidth; if cityPosition+layersWidth\*.5 \<= originX then activeCity, inactiveCity = inactiveCity, activeCity; end local bushPosition = activeBush.x; bushPosition = bushPosition-gameSpeed\*.4; activeBush.x = bushPosition; inactiveBush.x = bushPosition+layersWidth; if bushPosition+layersWidth\*.5 \<= originX then activeBush, inactiveBush = inactiveBush, activeBush; end end end Runtime:addEventListener("enterFrame", groundLayer1); return gameLayer; --we return a handle to our new game layer to use in our scene modules end composer.gotoScene("menuScene", "fade"); local screenShotNumber = 1; function keyIsPressed(event) if event.keyName == "a" and event.phase == "down" then display.save(storyboard.getScene(storyboard.getCurrentSceneName()).view, "screen"..screenShotNumber..".png", system.DocumentsDirectory, true); screenShotNumber = screenShotNumber+1; end end --Runtime:addEventListener("key", keyIsPressed);

Thank you!!!

This is one of the beauties of syntax highlighting… If you look at your table:  _G.iApItems = {, notice how the next few lines alternate colors? This is an indication that quotes are off. But the quotes seem to match until you examine the first quote in each line, it has a slight tilt to it indicating a “Smart quote”. Lua needs ASCII quotes and apostrophes, not the stylized ones.

Try replacing the lead quote in the next four lines to the " on the keyboard. This is symptomatic of copy/pasting from a word processor.

Rob

Thank you for your help! I’m using the TextEditor for Mac, maybe should be a better idea to use a specific program so I can notice these errors.

It seems to be that I’m cursed with the Facebook Plugin, is giving me the next error as shown in the screenshot when trying to run the app in my phone.

[sharedmedia=core:attachments:5204]

I don’t know why it gives that error, I put already the app ID. I might be missing the facebook plugin? But I already activated it.

When I try to play with the emulator, is saying that all the facebook files are missing.

Can you post your build.settings?

As for a text editor. Text Wrangler is free and pretty good. Sublime Text 3 is for pay, but they have a pretty lenient “shareware” model to try before you by. You can add the “Corona Editor” package to Sublime Text 3 to get some cool features like code completion, documentation lookup, debugging features, etc.

Rob

I will get that one now then. Thanks!!!

The build.settings

settings = { plugins = { ["plugin.google.iap.v3"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, ["CoronaProvider.gameNetwork.google"] = { publisherId = "com.coronalabs", supportedPlatforms = { android = true }, }, ["plugin.facebook.v4"] = { publisherId = "com.coronalabs" }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, --[[remove this line to implement TapForTap ["plugin.tapfortap"] = { -- required publisherId = "com.tapfortap", }, ]] --remove this line to implement TapForTap --[[remove this line to implement iAds ["CoronaProvider.ads.iads"] = { -- required publisherId = "com.coronalabs", }, ]] --remove this line to implement iAds ["facebook"] = { -- required publisherId = "com.coronalabs", supportedPlatforms = { iphone = true }, }, }, orientation = { default = "portrait", supported = { "portrait" } }, android = { googlePlayGamesAppId = "116596392089785", --insert your app id number for google game services usesPermissions = { "com.android.vending.BILLING", --remove this line if you don't use iAP "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.READ\_PHONE\_STATE" }, }, iphone = { plist = { CFBundleIconFile = "Icon.png", CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, UIApplicationExitsOnSuspend = false, -- must be false for single sign-on to work FacebookAppID = "116596392089785", -- replace XXXXXXXXX with your facebook appId CFBundleURLTypes = { { CFBundleURLSchemes = { "fb116596392089785", -- replace XXXXXXXXX with your facebook appId, make sure that you leave fb in front of it } } } } } }

If you look at the docs for the plugin, you will see there is more stuff you need to added to your build.settings. For the iphone table, there is a whole block of code to add. For Android you also have to include a facebookAppId too. Please note, the Android key starts with a lower case F where the iphone starts with a capital F (and it’s on purpose). Also the last “d” in ID is upper case on Apple, lower case for Android (also on purpose).

Patch up your build.settings and see how far you’re getting.

Rob

I put this line into main.lua

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

And the code fixed in build.settings:

settings = { plugins = { ["plugin.google.iap.v3"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, ["CoronaProvider.gameNetwork.google"] = { publisherId = "com.coronalabs", supportedPlatforms = { android = true }, }, ["plugin.facebook.v4"] = { publisherId = "com.coronalabs" }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, --[[remove this line to implement TapForTap ["plugin.tapfortap"] = { -- required publisherId = "com.tapfortap", }, ]] --remove this line to implement TapForTap --[[remove this line to implement iAds ["CoronaProvider.ads.iads"] = { -- required publisherId = "com.coronalabs", }, ]] --remove this line to implement iAds ["facebook"] = { -- required publisherId = "com.coronalabs", supportedPlatforms = { android = true }, }, }, orientation = { default = "portrait", supported = { "portrait" } }, android = { facebookAppId = "116596392089785", googlePlayGamesAppId = "680592051846", usesPermissions = { "com.android.vending.BILLING", --remove this line if you don't use iAP "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.READ\_PHONE\_STATE" }, }, iphone = { plist = { CFBundleIconFile = "Icon.png", CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, UIApplicationExitsOnSuspend = false, FacebookAppID = "116596392089785", CFBundleURLTypes = { { CFBundleURLSchemes = { "fb116596392089785", } } } } } }

The app I want to make it only for Android. I added the line but still keep getting the error somehow.

Module ‘facebook’ not found:

no field package.preload[‘facebook’]

no file ‘/Users/Snakewar/Library/Application Support/Corona/Simulator/Plugins/facebook.lua’

no file ‘/Users/Snakewar/Desktop/Flying Aliens/code/facebook.lua’

no file ‘/Applications/CoronaSDK/Corona Simulator.app/Contents/Resources/facebook.lua’

no file ‘/Users/Snakewar/Library/Application Support/Corona/Simulator/Plugins/facebook.dylib’

no file ‘./facebook.dylib’

no file ‘/Applications/CoronaSDK/Corona Simulator.app/Contents/Resources/facebook.dylib’

I really don’t understand what it could be the problem. I removed it all and put it back using the editor you suggested and worked fine.

Thank you so much for your help and patience! Appreciated!

Can you post your build.settings file please?

Also your code for setting up RevMob?

Thanks

Rob

Hi Rob, thank you for your fast reply. I must added wrongly or removed something that I wasn’t supposed to, I can’t run it anymore, now it says:

Error loading module ‘setupFile’ from file ‘/Users/Snakewar/Desktop/Flying Aliens/code/setupFile.lua’:

/Users/Snakewar/Desktop/Flying Aliens/code/setupFile.lua:19: unexpected symbol near ‘‚’

File: error loading module ‘setupFile’ from file ‘setupFile.lua’

stack traceback:

C: in function ‘require’

?: in function ‘require’

main.lua:10: in main chunk

 

The code of setupFile.lua is:

--CHECK adsLib.lua TO ADD YOUR ADS KEYS --CHECK build.settings TO FINALIZE SHARE/ADS --CHECK gameScene.lua TO CHANGE OTHER PARAMETERS RELATED TO THE GAME local ragdogLib = require "ragdogLib"; local adsLib = require "adsLib"; local networksLib = require "networksLib"; local totalWidth = \_G.totalWidth; local totalHeight = \_G.totalHeight; local leftSide = \_G.leftSide; local rightSide = \_G.rightSide; local topSide = \_G.topSide; local bottomSide = \_G.bottomSide; local centerX = display.contentCenterX; local centerY = display.contentCenterY; local layersWidth = math.max(512, totalWidth); \_G.activateInAppPurchase = true; \_G.iApItems = { [“250Coins"] = {"com.denwatech.100coins"}, [“500Coins"] = {"com.denwatech.500coins"}, [“1000Coins"] = {"com.denwatech.1000coins"}, ["removeAds"] = {"com.denwatech.removeAds”}, }; \_G.activeRemoveAdsButton = true; \_G.activateCharacterSelect = true; \_G.showInGameCurrency = true; \_G.totalCoins = ragdogLib.getSaveValue("coins") or 0; \_G.twitterConsumerKey = "zTOwTDWojSfMXSXK7RmpX3zmj"; \_G.twitterSecretKey = "i0Twy92iQbFg5d0aEHh1NcaPAWG3GiMMPpPmKjOaJ5HOgnwN7O"; \_G.facebookAPPID = "116596392089785"; \_G.socialShareMessage = "I just made totalPoints in Flying Aliens"; \_G.imageForSocialPluginShare = "Icon.png"; \_G.useSocialPlugin = true; --here we setup the data for the characters. You need to put the name for that character, the path for the spritesheet of that character, --width/height of the spritesheet, number of frames in the sheet, width/height of a single frame within the spritesheet, the path for the image that will appear in the selection screen, width/height of that image, if it's locked or not by default --and cost in in-game coins in case it's locked. --you can add as many characters as you want \_G.characterData = { [1] = { "Bird 1", "IMG/birdSheet.png", 150, 38, 3, 50, 38, "IMG/birdPortrait1.png", 43, 31, false }, [2] = { "Bird 2", "IMG/birdSheet2.png", 150, 38, 3, 50, 38, "IMG/birdPortrait2.png", 43, 31, true, 300 }, }; \_G.characterAnimation = { ["Bird 1"] = { {name = "flap", frames = {1, 2, 3, 2}, time = 400, loopCount = 0}, {name = "death", frames = {2}, time = 200, loopCount = 0}, }, ["Bird 2"] = { {name = "flap", frames = {1, 2, 3, 2}, time = 400, loopCount = 0}, {name = "death", frames = {2}, time = 200, loopCount = 0}, }, }; for i = 1, #\_G.characterData do if \_G.characterData[i][11] then if ragdogLib.getSaveValue(\_G.characterData[i][1]) then \_G.characterData[i][11] = false; if not \_G.chosenCharacter then \_G.chosenCharacter = \_G.characterData[i]; end end else if not \_G.chosenCharacter then \_G.chosenCharacter = \_G.characterData[i]; end end end --And here we can set our backgrounds. They're made up of 5 layers plus the pipes. --You can add infinite numbers of backgrounds. --Where present, the 4th number after path, width and height indicates the offset Y to position that layer relative to the ground. \_G.backgroundsData = { [1] = { sky = {"IMG/bg.png", totalWidth, totalHeight}, ground = {"IMG/ground.png", layersWidth, 124}, city = {"IMG/skyline.png", layersWidth, 64, -30}, bushes = {"IMG/grass.png", layersWidth, 52, -5}, clouds = {"IMG/clouds.png", layersWidth, 112, -40}, pipes = {"IMG/tube.png", 60, 512} }, [2] = { sky = {"IMG/bg2.png", totalWidth, totalHeight}, ground = {"IMG/ground2.png", layersWidth, 124}, city = {"IMG/skyline2.png", layersWidth, 64, -30}, bushes = {"IMG/grass2.png", layersWidth, 52, -5}, clouds = {"IMG/clouds2.png", layersWidth, 112, -40}, pipes = {"IMG/tube.png", 60, 512} } }; local activeNetworksProviders = { ["Android"] = {"google", "YOUR LEADERBOARD ID"}, --replace "google" with "none" if you don't use any leaderboard! ["iPhone OS"] = {"gamecenter", "YOUR LEADERBOARD ID"} --replace "gamecenter" with "none" if you don't use any leaderboard! }; local function systemEvents( event ) if ( event.type == "applicationSuspend" ) then elseif ( event.type == "applicationResume" ) then elseif ( event.type == "applicationExit" ) then elseif ( event.type == "applicationStart" ) then networksLib.init(activeNetworksProviders); end return true end Runtime:addEventListener( "system", systemEvents ) --CHECK TUTORIAL ON HOW TO SET ADS UP HERE http://ragdogstudios.com/2014/08/23/adslib-v2-how-to-implement-it-and-maximize-your-revenues/ local adsSettings = { ["iPhone"] = { ["game\_over"] = { mediationType = "order", adType = "interstitial", frequency = 1, keepOrderDuringSession = true, providers = { [1] = { providerName = "chartboost", providerFallback = 2, mustBeCached = true, }, [2] = { providerName = "revmob", providerFallback = 1, mustBeCached = false } } }, ["during\_game"] = { mediationType = "order", adType = "banner", frequency = 1, adPosition = "top", keepOrderDuringSession = true, providers = { [1] = { providerName = "revmob", providerFallback = nil } } } }, ["Android"] = { ["game\_over"] = { mediationType = "order", adType = "interstitial", frequency = 1, keepOrderDuringSession = true, providers = { [1] = { providerName = "chartboost", providerFallback = 2, mustBeCached = true, }, [2] = { providerName = "revmob", providerFallback = 1, mustBeCached = false } } }, ["during\_game"] = { mediationType = "order", adType = "banner", frequency = 1, adPosition = "top", keepOrderDuringSession = true, providers = { [1] = { providerName = "revmob", providerFallback = nil } } } } }; local activeAdsProviders = { ["Android"] = {"revmob", "chartboost"}, -- possible values are "tapfortap", "admob", "playhaven", "revmob", "chartboost", "iads" ["iPhone"] = {"revmob", "chartboost"} --it should include all the ads providers you've put in the adsSettings table }; adsLib.init(activeAdsProviders, adsSettings);

And for main.lua is

display.setStatusBar(display.HiddenStatusBar); \_G.totalWidth = display.contentWidth-(display.screenOriginX\*2); \_G.totalHeight = display.contentHeight-(display.screenOriginY\*2); \_G.leftSide = display.screenOriginX; \_G.rightSide = display.contentWidth-display.screenOriginX; \_G.topSide = display.screenOriginY; \_G.bottomSide = display.contentHeight-display.screenOriginY; local setupFile = require "setupFile"; local facebook = require( "plugin.facebook.v4" ) local fpsLib = require "fpsLib"; local composer = require "composer"; composer.recycleOnSceneChange = true; fpsLib.init(); \_G.buttonSFX = audio.loadSound("SFX/wooshSFX.mp3"); local totalWidth = \_G.totalWidth; --I localize this because it'll be used intesively here; local originX = display.screenOriginX --we're gonna need this as well; --we put the creation of the level parallax effect here, since we're going to use that in most scenes \_G.createParallaxBackground = function(group, bgData) --let's hold a single width for all the layers, to help support multi devices and improve performances local layersWidth = math.max(512, totalWidth); --layer for the ground local activeGround, inactiveGround, groundLayer1, groundLayer2; groundLayer1 = display.newImageRect(group, bgData.ground[1], bgData.ground[2], bgData.ground[3]); groundLayer1.x, groundLayer1.y = display.contentCenterX, display.contentHeight; groundLayer2 = display.newImageRect(group, bgData.ground[1], bgData.ground[2], bgData.ground[3]); groundLayer2.x, groundLayer2.y = groundLayer1.x+layersWidth, groundLayer1.y; activeGround = groundLayer1; inactiveGround = groundLayer2; --layer with the clouds local activeClouds, inactiveClouds, cloudsLayer1, cloudsLayer2; cloudsLayer1 = display.newImageRect(group, bgData.clouds[1], bgData.clouds[2], bgData.clouds[3]); cloudsLayer1.x, cloudsLayer1.y = groundLayer1.x, groundLayer1.contentBounds.yMin+bgData.clouds[4]; cloudsLayer2 = display.newImageRect(group, bgData.clouds[1], bgData.clouds[2], bgData.clouds[3]); cloudsLayer2.x, cloudsLayer2.y = cloudsLayer1.x+layersWidth, cloudsLayer1.y; activeClouds = cloudsLayer1; inactiveClouds = cloudsLayer2; --layer for the city local activeCity, inactiveCity, cityLayer1, cityLayer2; cityLayer1 = display.newImageRect(group, bgData.city[1], bgData.city[2], bgData.city[3]); cityLayer1.x, cityLayer1.y = groundLayer1.x, groundLayer1.contentBounds.yMin+bgData.city[4]; cityLayer2 = display.newImageRect(group, bgData.city[1], bgData.city[2], bgData.city[3]); cityLayer2.x, cityLayer2.y = cityLayer1.x+layersWidth, cityLayer1.y; activeCity = cityLayer1; inactiveCity = cityLayer2; --layer for the bushes local activeBush, inactiveBush, bushLayer1, bushLayer1; bushLayer1 = display.newImageRect(group, bgData.bushes[1], bgData.bushes[2], bgData.bushes[3]); bushLayer1.x, bushLayer1.y = groundLayer1.x, groundLayer1.contentBounds.yMin+bgData.bushes[4]; bushLayer2 = display.newImageRect(group, bgData.bushes[1], bgData.bushes[2], bgData.bushes[3]); bushLayer2.x, bushLayer2.y = bushLayer1.x+layersWidth, bushLayer1.y; activeBush = bushLayer1; inactiveBush = bushLayer2; --we create our game layer here, so that pipes and birds will be below the ground but over the background local gameLayer = display.newGroup(); group:insert(gameLayer); group:insert(groundLayer1); group:insert(groundLayer2); function groundLayer1:enterFrame() if not group.paused then local gameSpeed = group.gameSpeed; local groundPosition = activeGround.x; groundPosition = groundPosition-gameSpeed; activeGround.x = groundPosition; inactiveGround.x = groundPosition+layersWidth; if groundPosition+layersWidth\*.5 \<= originX then activeGround, inactiveGround = inactiveGround, activeGround; end local cloudPosition = activeClouds.x; cloudPosition = cloudPosition-gameSpeed\*.1; activeClouds.x = cloudPosition; inactiveClouds.x = cloudPosition+layersWidth; if cloudPosition+layersWidth\*.5 \<= originX then activeClouds, inactiveClouds = inactiveClouds, activeClouds; end local cityPosition = activeCity.x; cityPosition = cityPosition-gameSpeed\*.2; activeCity.x = cityPosition; inactiveCity.x = cityPosition+layersWidth; if cityPosition+layersWidth\*.5 \<= originX then activeCity, inactiveCity = inactiveCity, activeCity; end local bushPosition = activeBush.x; bushPosition = bushPosition-gameSpeed\*.4; activeBush.x = bushPosition; inactiveBush.x = bushPosition+layersWidth; if bushPosition+layersWidth\*.5 \<= originX then activeBush, inactiveBush = inactiveBush, activeBush; end end end Runtime:addEventListener("enterFrame", groundLayer1); return gameLayer; --we return a handle to our new game layer to use in our scene modules end composer.gotoScene("menuScene", "fade"); local screenShotNumber = 1; function keyIsPressed(event) if event.keyName == "a" and event.phase == "down" then display.save(storyboard.getScene(storyboard.getCurrentSceneName()).view, "screen"..screenShotNumber..".png", system.DocumentsDirectory, true); screenShotNumber = screenShotNumber+1; end end --Runtime:addEventListener("key", keyIsPressed);

Thank you!!!

This is one of the beauties of syntax highlighting… If you look at your table:  _G.iApItems = {, notice how the next few lines alternate colors? This is an indication that quotes are off. But the quotes seem to match until you examine the first quote in each line, it has a slight tilt to it indicating a “Smart quote”. Lua needs ASCII quotes and apostrophes, not the stylized ones.

Try replacing the lead quote in the next four lines to the " on the keyboard. This is symptomatic of copy/pasting from a word processor.

Rob

Thank you for your help! I’m using the TextEditor for Mac, maybe should be a better idea to use a specific program so I can notice these errors.

It seems to be that I’m cursed with the Facebook Plugin, is giving me the next error as shown in the screenshot when trying to run the app in my phone.

[sharedmedia=core:attachments:5204]

I don’t know why it gives that error, I put already the app ID. I might be missing the facebook plugin? But I already activated it.

When I try to play with the emulator, is saying that all the facebook files are missing.

Can you post your build.settings?

As for a text editor. Text Wrangler is free and pretty good. Sublime Text 3 is for pay, but they have a pretty lenient “shareware” model to try before you by. You can add the “Corona Editor” package to Sublime Text 3 to get some cool features like code completion, documentation lookup, debugging features, etc.

Rob

I will get that one now then. Thanks!!!

The build.settings

settings = { plugins = { ["plugin.google.iap.v3"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, ["CoronaProvider.gameNetwork.google"] = { publisherId = "com.coronalabs", supportedPlatforms = { android = true }, }, ["plugin.facebook.v4"] = { publisherId = "com.coronalabs" }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, --[[remove this line to implement TapForTap ["plugin.tapfortap"] = { -- required publisherId = "com.tapfortap", }, ]] --remove this line to implement TapForTap --[[remove this line to implement iAds ["CoronaProvider.ads.iads"] = { -- required publisherId = "com.coronalabs", }, ]] --remove this line to implement iAds ["facebook"] = { -- required publisherId = "com.coronalabs", supportedPlatforms = { iphone = true }, }, }, orientation = { default = "portrait", supported = { "portrait" } }, android = { googlePlayGamesAppId = "116596392089785", --insert your app id number for google game services usesPermissions = { "com.android.vending.BILLING", --remove this line if you don't use iAP "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.READ\_PHONE\_STATE" }, }, iphone = { plist = { CFBundleIconFile = "Icon.png", CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, UIApplicationExitsOnSuspend = false, -- must be false for single sign-on to work FacebookAppID = "116596392089785", -- replace XXXXXXXXX with your facebook appId CFBundleURLTypes = { { CFBundleURLSchemes = { "fb116596392089785", -- replace XXXXXXXXX with your facebook appId, make sure that you leave fb in front of it } } } } } }

If you look at the docs for the plugin, you will see there is more stuff you need to added to your build.settings. For the iphone table, there is a whole block of code to add. For Android you also have to include a facebookAppId too. Please note, the Android key starts with a lower case F where the iphone starts with a capital F (and it’s on purpose). Also the last “d” in ID is upper case on Apple, lower case for Android (also on purpose).

Patch up your build.settings and see how far you’re getting.

Rob

I put this line into main.lua

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

And the code fixed in build.settings:

settings = { plugins = { ["plugin.google.iap.v3"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, ["CoronaProvider.gameNetwork.google"] = { publisherId = "com.coronalabs", supportedPlatforms = { android = true }, }, ["plugin.facebook.v4"] = { publisherId = "com.coronalabs" }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, --[[remove this line to implement TapForTap ["plugin.tapfortap"] = { -- required publisherId = "com.tapfortap", }, ]] --remove this line to implement TapForTap --[[remove this line to implement iAds ["CoronaProvider.ads.iads"] = { -- required publisherId = "com.coronalabs", }, ]] --remove this line to implement iAds ["facebook"] = { -- required publisherId = "com.coronalabs", supportedPlatforms = { android = true }, }, }, orientation = { default = "portrait", supported = { "portrait" } }, android = { facebookAppId = "116596392089785", googlePlayGamesAppId = "680592051846", usesPermissions = { "com.android.vending.BILLING", --remove this line if you don't use iAP "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.READ\_PHONE\_STATE" }, }, iphone = { plist = { CFBundleIconFile = "Icon.png", CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, UIApplicationExitsOnSuspend = false, FacebookAppID = "116596392089785", CFBundleURLTypes = { { CFBundleURLSchemes = { "fb116596392089785", } } } } } }

The app I want to make it only for Android. I added the line but still keep getting the error somehow.

Module ‘facebook’ not found:

no field package.preload[‘facebook’]

no file ‘/Users/Snakewar/Library/Application Support/Corona/Simulator/Plugins/facebook.lua’

no file ‘/Users/Snakewar/Desktop/Flying Aliens/code/facebook.lua’

no file ‘/Applications/CoronaSDK/Corona Simulator.app/Contents/Resources/facebook.lua’

no file ‘/Users/Snakewar/Library/Application Support/Corona/Simulator/Plugins/facebook.dylib’

no file ‘./facebook.dylib’

no file ‘/Applications/CoronaSDK/Corona Simulator.app/Contents/Resources/facebook.dylib’

I really don’t understand what it could be the problem. I removed it all and put it back using the editor you suggested and worked fine.

Thank you so much for your help and patience! Appreciated!