Now it say there is a error in my build.settings.
Read the tutorial. Make sure you’re syntax is all right. It’s reallllllllllly important that you learn to indent your code so you can see where things line up with each other. For instance, when you see this:
}
}
}
}
},
}
You have no ideal which one of those closing braces balances an opening brace earlier. Consider your version:
CFBundleURLTypes =
{
{
CFBundleURLSchemes =
{
“fb329435700566704”, – replace XXXXXXXXX with your facebook appId, make sure that you leave fb in front of
“app910588198”
}
}
}
}
},
}
vs this:
CFBundleURLTypes =
{
{
CFBundleURLSchemes =
{
“fb329435700566704”, – replace XXXXXXXXX with your facebook appId, make sure that you leave fb in front of
“app910588198”
}
}
}
} --<---- this brace goes with something else, probably the plist = {
}, --<---- this brace goes with something else, probably the iphone = {
} --<---- this brace goes with something else, probably the settings = {
– any thing after that isn’t part of the settings table.
Once you indent everything properly and make sure things are ending in commas where necessary, post it back and we will look at it.
Rob
Like this?
– Supported values for orientation:
– portrait, portraitUpsideDown, landscapeLeft, landscapeRight
settings = {
plugins = {
[“CoronaProvider.ads.admob”] =
{
publisherId = “com.coronalabs”,
–supportedPlatforms = { iphone=true }
},
[“plugin.google.play.services”] =
{
publisherId = “com.coronalabs”,
–supportedPlatforms = { Android=true },
},
[“CoronaProvider.gameNetwork.google”] =
{
–required!
publisherId = “com.coronalabs”,
–supportedPlatforms = { android=true }
},
[“facebook”] =
{
publisherId = “com.coronalabs”,
–supportedPlatforms = { iphone=true},
},
},
orientation = {
default = “portrait”,
supported = { “portrait”, }
},
android =
{
usesPermissions =
{
“android.permission.INTERNET”,
“android.permission.ACCESS_NETWORK_STATE”,
},
},
iphone = {
plist = {
UIAppFonts =
{
“QuentinCaps.ttf”,
},
UIViewControllerBasedStatusBarAppearance = false,
UIStatusBarHidden = true,
CFBundleIconFile = “Icon.png”,
CFBundleShortVersionString = “1.0”,
CFBundleIconFiles =
{
“Icon.png”,
“Icon@2x.png”,
“Icon-60.png”,
“Icon-60@2x.png”,
“Icon-72.png”,
“Icon-76.png”,
“Icon-76@2x.png”,
“Icon-Small.png”,
“Icon-Small@2x.png”,
“Icon-Small-50.png”,
“Icon-Small-50@2x.png”,
},
UIApplicationExitsOnSuspend = false, – must be false for single sign-on to work
FacebookAppID = “329435700566704”, – replace XXXXXXXXX with your facebook appId
CFBundleURLTypes =
{
{
CFBundleURLSchemes =
{
“fb329435700566704”, – replace XXXXXXXXX with your facebook appId, make sure that you leave fb in front of
“app910588198”
}
}
}
}
},
}
settings = {
plugins =
{
[“facebook”] =
{
publisherId = “com.coronalabs”,
supportedPlatforms = { iphone=true, [“iphone-sim”]=true },
},
},
}
Are you trying to troll Rob? I kid, I kid.
Can you post your build.settings using the “code” formatting option available when you’re drafting a post?
Thanks Prathap!
-- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = { plugins = { ["CoronaProvider.ads.admob"] = { publisherId = "com.coronalabs", --supportedPlatforms = { iphone=true } }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", --supportedPlatforms = { Android=true }, }, ["CoronaProvider.gameNetwork.google"] = { --required! publisherId = "com.coronalabs", --supportedPlatforms = { android=true } }, ["facebook"] = { publisherId = "com.coronalabs", --supportedPlatforms = { iphone=true}, }, }, orientation = { default = "portrait", supported = { "portrait", } }, android = { usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", }, }, iphone = { plist = { UIAppFonts = { "QuentinCaps.ttf", }, UIViewControllerBasedStatusBarAppearance = false, UIStatusBarHidden = true, CFBundleIconFile = "Icon.png", CFBundleShortVersionString = "1.0", 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-50.png", "Icon-Small-50@2x.png", }, UIApplicationExitsOnSuspend = false, -- must be false for single sign-on to work FacebookAppID = "329435700566704", -- replace XXXXXXXXX with your facebook appId CFBundleURLTypes = { { CFBundleURLSchemes = { "fb329435700566704", -- replace XXXXXXXXX with your facebook appId, make sure that you leave fb in front of "app910588198" } } } } }, } settings = { plugins = { ["facebook"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, ["iphone-sim"]=true }, }, }, } settings = { plugins = { ["plugin.google.play.services"] = { pub-8347067101481503 = "com.coronalabs" }, }, } android = { usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", }, },
Thank you for that info. No I’m not trying to troll anyone. I’m trying to fix my app errors.
You have to appreciate the humour in that situation. First, you posted semi-indented code. Then Rob stressed the importance of code indentation. You followed that up by posting code where all formatting was lost. I just found it genuinely funny. I never meant to mock or offend you. Cheer up, man.
If you’re not doing it already, use Sublime Text for coding. It’s a stellar code editor which is available for free. And always indent code with tabs instead of spaces.
I’ve fixed your build.settings. There were 3 problems –
-
For the plugin [“CoronaProvider.gameNetwork.google”], you need to uncomment _ supportedPlatforms = { android=true } _.
-
You had included the ‘android’ table within the ‘settings’ table once and then once more outside the ‘settings’ table (towards the bottom). They need to be merged into one. Also, you only need one ‘settings’ table. Include everything inside it.
-
For Google Play Services plugin, you’d mentioned this – _ pub-8347067101481503 = “com.coronalabs” _. Let’s say 8347067101481503 is your Google Play Games App ID, then you need to specify it like this googlePlayGamesAppId = “8347067101481503” in the android table and not the way you had specified it. Check the documentation here – http://docs.coronalabs.com/daily/plugin/gameNetwork-google/
Here’s the fixed build.settings file with which I was able to build successfully –
settings = { orientation = { default = "portrait", supported = { "portrait", } }, plugins = { ["CoronaProvider.ads.admob"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true } }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { Android=true }, }, ["CoronaProvider.gameNetwork.google"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, ["facebook"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, ["iphone-sim"]=true }, }, }, android = { usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", }, googlePlayGamesAppId = "8347067101481503" }, 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-50.png", "Icon-Small-50@2x.png", }, UIAppFonts = { "QuentinCaps.ttf", }, CFBundleShortVersionString = "1.0", UIViewControllerBasedStatusBarAppearance = false, UIStatusBarHidden = true, UIApplicationExitsOnSuspend = false, -- must be false for single sign-on to work FacebookAppID = "329435700566704", -- replace XXXXXXXXX with your facebook appId CFBundleURLTypes = { { CFBundleURLSchemes = { "fb329435700566704", -- replace XXXXXXXXX with your facebook appId "app910588198" } } } } }, }
Than you so much for this. My banner ads dont show up, any ideas on this?
local composer = require( "composer" ) display.setStatusBar(display.HiddenStatusBar) \_G.prefLib = require "prefLib" \_G.adsLib = require "adsLib" \_G.networksLib = require "networksLib"; local activeNetworksProviders = { ["Android"] = {"google", "CgkIhNyInMgZEAIQAQ"}, ["iPhone OS"] = {"gamecenter", "CgkIhNyInMgZEAIQAQ"} --replace "gamecenter" with "none" if you don't use any leaderboard! }; --networksLib.init(activeNetworksProviders); -- For in game Ad's use this table and call local activeAdsProviders = { ["Android"] = {"chartboost","admob","revmob"}, ["iPhone OS"] = {"chartboost","admob","revmob"}, }; adsLib.init(activeAdsProviders); local ads = require( "ads" ) local bannerAppID = "ca-app-pub-8347067101481503/4080572917" --for your iOS banner if ( system.getInfo( "platformName" ) == "Android" ) then bannerAppID = "ca-app-pub-8347067101481503/2335507715" --for your Android banner end local adProvider = "admob" local function adListener( event ) -- The 'event' table includes: -- event.name: string value of "adsRequest" -- event.response: message from the ad provider about the status of this request -- event.phase: string value of "loaded", "shown", or "refresh" -- event.type: string value of "banner" or "interstitial" -- event.isError: boolean true or false local msg = event.response -- Quick debug message regarding the response from the library print( "Message from the ads library: ", msg ) if ( event.isError ) then print( "Error, no ad received", msg ) else print( "Ah ha! Got one!" ) end end ads.init( adProvider, appID, adListener ) ads.show( "banner", { x=0, y=0 } ) ---===================sound related tasks \_G.musicChannel = 1; audio.reserveChannels(1); --and let's immediately set the volume to the values saved throughout plays local m = prefLib.getSaveValue("musicVolume") or .3 prefLib.setSaveValue("musicVolume",m,true) audio.setVolume(m, {channel = \_G.musicChannel}); for i = 2, audio.totalChannels do local s = \_G.prefLib.getSaveValue("sfxVolume") or 1 prefLib.setSaveValue("sfxVolume",s,true) audio.setVolume(s, {channel = i}); end --also, we're going to use this sound everywhere, so I'll load it here as a global variable once \_G.splashSFX = audio.loadSound("sounds/splash.mp3"); \_G.clickSFX = audio.loadSound("sounds/click.wav"); \_G.fireSFX = audio.loadSound("sounds/spring.wav"); \_G.jumpSFX = audio.loadSound("sounds/jump.wav"); \_G.rocketSFX = audio.loadSound("sounds/rocket.wav"); \_G.fallSFX = audio.loadSound("sounds/fall.wav"); \_G.coinSFX = audio.loadSound("sounds/coin.mp3"); audio.play(splashSFX, {channel = audio.findFreeChannel()}); -- Later... local img = display.newImageRect("assets/Splash Screen1.jpg",640,1136) img.x = display.contentWidth/2 img.y = display.contentHeight/2 local function move() display.remove(img);img = nil composer.gotoScene( "homescene","fade",1500 ) end timer.performWithDelay(4000,move,1)
My main.lua code
I’m a basic member and it still doesn’t show up. Any ideas or thoughts on how to fix the code to where the banner ads show up?
Thanks,
Bryan
Think you an please help me fix the code to were my banner ads show up?
Thanks,
Bryan
Any ideas on this? My main.lua code
local composer = require( "composer" ) display.setStatusBar(display.HiddenStatusBar) \_G.prefLib = require "prefLib" \_G.adsLib = require "adsLib" \_G.networksLib = require "networksLib"; local activeNetworksProviders = { ["Android"] = {"google", "CgkIhNyInMgZEAIQAQ"}, ["iPhone OS"] = {"gamecenter", "CgkIhNyInMgZEAIQAQ"} --replace "gamecenter" with "none" if you don't use any leaderboard! }; --networksLib.init(activeNetworksProviders); -- For in game Ad's use this table and call local activeAdsProviders = { ["Android"] = {"chartboost","admob","revmob"}, ["iPhone OS"] = {"chartboost","admob","revmob"}, }; adsLib.init(activeAdsProviders); local ads = require( "ads" ) local bannerAppID = "ca-app-pub-8347067101481503/4080572917" --for your iOS banner if ( system.getInfo( "platformName" ) == "Android" ) then bannerAppID = "ca-app-pub-8347067101481503/2335507715" --for your Android banner end local adProvider = "admob" local function adListener( event ) -- The 'event' table includes: -- event.name: string value of "adsRequest" -- event.response: message from the ad provider about the status of this request -- event.phase: string value of "loaded", "shown", or "refresh" -- event.type: string value of "banner" or "interstitial" -- event.isError: boolean true or false local msg = event.response -- Quick debug message regarding the response from the library print( "Message from the ads library: ", msg ) if ( event.isError ) then print( "Error, no ad received", msg ) else print( "Ah ha! Got one!" ) end end ads.init( adProvider, appID, adListener ) ads.show( "banner", { x=0, y=0 } ) ---===================sound related tasks \_G.musicChannel = 1; audio.reserveChannels(1); --and let's immediately set the volume to the values saved throughout plays local m = prefLib.getSaveValue("musicVolume") or .3 prefLib.setSaveValue("musicVolume",m,true) audio.setVolume(m, {channel = \_G.musicChannel}); for i = 2, audio.totalChannels do local s = \_G.prefLib.getSaveValue("sfxVolume") or 1 prefLib.setSaveValue("sfxVolume",s,true) audio.setVolume(s, {channel = i}); end --also, we're going to use this sound everywhere, so I'll load it here as a global variable once \_G.splashSFX = audio.loadSound("sounds/splash.mp3"); \_G.clickSFX = audio.loadSound("sounds/click.wav"); \_G.fireSFX = audio.loadSound("sounds/spring.wav"); \_G.jumpSFX = audio.loadSound("sounds/jump.wav"); \_G.rocketSFX = audio.loadSound("sounds/rocket.wav"); \_G.fallSFX = audio.loadSound("sounds/fall.wav"); \_G.coinSFX = audio.loadSound("sounds/coin.mp3"); audio.play(splashSFX, {channel = audio.findFreeChannel()}); -- Later... local img = display.newImageRect("assets/Splash Screen1.jpg",640,1136) img.x = display.contentWidth/2 img.y = display.contentHeight/2 local function move() display.remove(img);img = nil composer.gotoScene( "homescene","fade",1500 ) end timer.performWithDelay(4000,move,1)
You seem to be performing an ads.init with the variable appID. But I don’t see you initializing that anywhere. Instead, you seem to be initializing bannerAppID. Call ads.init with bannerAppID. Also, you can’t concatenate all ad app IDs in one variable. Initialize bannerAppID with any one ad network’s app ID.
can you please update this in my main.lua code to were the banner ads will show up?
Thanks
In your build settings please change this:
["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { Android=true }, },
to
["plugin.google.play.services"] = { publisherId = "com.coronalabs", },
If you intend to run this on iOS devices. AdMob can run on both. If you want to just run it on Android then you need to change the “Android” to “android”. Case matters.
In your main.lua change this:
ads.init( adProvider, appID, adListener )
to this:
ads.init( adProvider, bannerAppID, adListener )
Finally, please be patient and give the community time to respond to your posts.
Rob
I’ve done everything you stated and doesn’t show banner ads. Please help me fix this ASAP. I want banner ads to show on both iOS and android.
Thanks
Are you building for a device and testing on a device?
Are you getting any errors in the device’s console log?
Building to submit an update to the app and no i’m not. The banner ads don’t show up in the corona simulator, unless their not supposed too? Let me know please.
You should be testing ads on the device.