Plugins 'Hell'

Hey guys,

So I have a feeling that this is not rigth: For each platform i need to change set of plagins(Amazon, GPGS) - to turn off all that i dont need for next build.

But on other hand - it is obvious - Plugin for GP should be ignored for iOS build.

Its not super-bug, but that something that bothers me.

I’ve noticed that too.  If I use iAds in my iOS version, I have to remove the plugin code from build.settings before building for Android, or the build will fail.

It would be nice if Corona simply ignored plugins listed in build.settings if the plugin doesn’t exist for the platform the build is targeting.

  • Andrew
  • 1

-Stephen

Andrew,

iads dosent need a special plugin:

options_ads_iads = (optionsBuild == “ios”);

ext_ads = require “ads”;

if(options_ads_iads)then

            ext_ads.init( “iads”, “com.elitegamesltd.controlcraft”, adListener);

    elseif(options_ads_inmobi)then

        if(optionsBuild == “ios”)then

            ext_ads.init( “inmobi”, “4028cbffXXXXXXXXXX5a470639”);

        elseif(optionsBuild == “android”)then

            ext_ads.init( “inmobi”, “4028cbffXXXXXXXXXX5a470639”);

        else

            options_ads_inmobi = false;

        end

    end


just rule them out with IF =)

@efgames.net,

iAds (and the other networks) are all plugins, as described here: http://docs.coronalabs.com/guide/monetization/adSupport/index.html

If you’re using an older build, you might still able to use iAds not as a plugin, but when it was built into the Corona core.  But now, it’s only accessible as a plugin.

  • Andrew

You can add the following in build.setting to control which platforms include the plugin. You still need to add conditional code in you main.lua so you only require the proper plugin for the current platform:

settings = {     plugins =     {         -- key is the name passed to Lua's 'require()'         ["CoronaProvider.ads.iads"] =         {             -- required             publisherId = "com.coronalabs",             supportedPlatforms = { iphone = true },         },     }, }

The following platforms are supported: iphone, android, android-kindle, android-nook

You need to list all the platforms supported and leave out the ones not supported. Setting the platform to false does not work at this time.

Thanks Tom, that’s helpful.  Is the supportedPlatforms key documented anywhere?

  • Andrew

I’m not understanding how supportedPlatforms is supposed to work.  I tried this in the first part of my plugins settings

settings = {     plugins =      {         ["plugin.amazon.iap"] = { publisherId = "com.amazon", supportedPlatforms = { android-kindle = "true" },},         ["CoronaProvider.gameNetwork.google"] = { publisherId = "com.coronalabs", supportedPlatforms = { android = true },},         ["CoronaProvider.ads.vungle"] = { publisherId = "com.vungle", },         ["plugin.carrot"] = { publisherId = "com.gocarrot", },     },  

but if I attempt to build for a device I get an error message popup “There is an error in your build.settings.”  and the console says "Syntax error: …/build.settings:5: ‘}’ expected near ‘=’ "  but I don’t see the syntax error.  Is supportedPlatforms supposed to work for all plugins?

-Stephen

If you post your full build.settings, perhaps we could help spot the error.

I just tried supportedPlatforms for the iAds plugin, and it worked for me.

  • Andrew

I tried building without the supportedPlatforms on the Amazon plugin and there was no syntax error.  I still had it enabled for the google gameNetwork and Vungle plugins so I guess it doesn’t work for Amazon plugin, which is still in beta test.  

But I hope it will eventually work for the Amazon plugin as well since that is one of the ones I have to manually comment out of build settings if I’m not building specifically for Kindle.

(I know in the sample above I had the “true” in …android-kindle = true… surrounded by quotes, but that wasn’t the issue.  That was just me trying various things to get it to work and I cut and paste that version here.  Both ways produced the syntax error with the Amazon plugin)

Yes, this looks like a error:

supportedPlatforms = { android-kindle = true }

name of variable is with “-” - that is definetly a mistake =(

Can Tom fix it in his post? maybe there should be different names? like “android_kindle”?

Yes, we looked into this and the server is getting hung up on the dashes in the key. Try the following:

supportedPlatforms = { “android-kindle” = true }

Tom, wouldn’t the more likely fix be this?

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

You’d need brackets around a string key that has special characters.

  • Andrew

@Andrew, yes you’re right. Thanks.

I’ve noticed that too.  If I use iAds in my iOS version, I have to remove the plugin code from build.settings before building for Android, or the build will fail.

It would be nice if Corona simply ignored plugins listed in build.settings if the plugin doesn’t exist for the platform the build is targeting.

  • Andrew
  • 1

-Stephen

Andrew,

iads dosent need a special plugin:

options_ads_iads = (optionsBuild == “ios”);

ext_ads = require “ads”;

if(options_ads_iads)then

            ext_ads.init( “iads”, “com.elitegamesltd.controlcraft”, adListener);

    elseif(options_ads_inmobi)then

        if(optionsBuild == “ios”)then

            ext_ads.init( “inmobi”, “4028cbffXXXXXXXXXX5a470639”);

        elseif(optionsBuild == “android”)then

            ext_ads.init( “inmobi”, “4028cbffXXXXXXXXXX5a470639”);

        else

            options_ads_inmobi = false;

        end

    end


just rule them out with IF =)

@efgames.net,

iAds (and the other networks) are all plugins, as described here: http://docs.coronalabs.com/guide/monetization/adSupport/index.html

If you’re using an older build, you might still able to use iAds not as a plugin, but when it was built into the Corona core.  But now, it’s only accessible as a plugin.

  • Andrew

You can add the following in build.setting to control which platforms include the plugin. You still need to add conditional code in you main.lua so you only require the proper plugin for the current platform:

settings = {     plugins =     {         -- key is the name passed to Lua's 'require()'         ["CoronaProvider.ads.iads"] =         {             -- required             publisherId = "com.coronalabs",             supportedPlatforms = { iphone = true },         },     }, }

The following platforms are supported: iphone, android, android-kindle, android-nook

You need to list all the platforms supported and leave out the ones not supported. Setting the platform to false does not work at this time.

Thanks Tom, that’s helpful.  Is the supportedPlatforms key documented anywhere?

  • Andrew