0
我build.settings電暈Admobs集成問題
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的論壇,但我仍然無法得到它。
如果您有任何問題,我會樂意提供一些建議。