我的build.settings
settings =
{
orientation =
{
default = "portrait",
},
android =
{
versionCode = "11"
},
androidPermissions =
{
"android.permission.INTERNET",
"android.permission.WRITE_EXTERNAL_STORAGE",
"android.permission.ACCESS_NETWORK_STATE",
"android.permission.READ_PHONE_STATE",
},
build =
{
neverStripDebugInfo = true
},
plugins =
{
["CoronaProvider.ads.admob"] =
{
publisherId = "com.coronalabs",
supportedPlatforms = { ["android"] = true }
}
}
}
我的main.lua
local background = display.newImage("backgroundrain.png")
background.x = display.contentWidth / 2
background.y = display.contentHeight / 2
local provider = "admob"
local appID = ""
local ads = require "ads"
--button
local widget = require( "widget" )
provider = "admob"
appID = ""
AD_TYPE = "banner"
local ads = require( "ads" )
local button1 = widget.newButton
{
defaultFile = "finallpicture.png",
overFile = "finallpicture2.png",
label = "",
emboss = true,
onPress = "finallpicture2.png",
onRelease = "finallpicture2.png",
}
button1.x = 495; button1.y = 950
local theaudio = audio.loadStream("theaudio.mp3")
function button1:touch(e)
if(e.phase == "ended") then
audio.play(theaudio)
end
end
button1:addEventListener("touch", button1)
local function adListener( event )
-- event table includes:
-- event.provider
-- event.isError (e.g. true/false )
local msg = event.response
-- just a quick debug message to check what response we got from the library
print("Message received from the ads library: ", msg)
if event.isError then
statusText:setTextColor( 255, 0, 0 )
statusText.text = "Error Loading Ad"
statusText.x = display.contentWidth * 0.5
showAd( "banner" )
else
statusText:setTextColor( 0, 255, 0 )
statusText.text = "Successfully Loaded Ad"
statusText.x = display.contentWidth * 0.5
end
end
-- Initialize the 'ads' library with the provider you wish to use.
if appID then
ads.init( provider, appID, adListener )
end
当我运行我的代码时,我会弹出一个窗口,显示“插件下载错误”无法下载followign插件: com.coronalabs / CoronaProvider.ads.admob。
我知道我很可能会遗漏一些重要的东西,我一直试图调试好几天。我阅读了有关Corona Admobs Integration的日冕论坛,但我仍然无法得到它。
如果你有任何建议我会很喜欢。
答案 0 :(得分:1)
如果你看看文档。 adMob 插件的 build.settings 错误,根据docs替换:
plugins =
{
["CoronaProvider.ads.admob"] =
{
publisherId = "com.coronalabs",
supportedPlatforms = { ["android"] = true }
}
}
与
plugins =
{
["plugin.google.play.services"] =
{
publisherId = "com.coronalabs",
supportedPlatforms = { iphone=false, android=true }
},
},
}