Greetings to all again! As always, I encountered a mistake. I installed the plugin through the new store. In the build setting, I registered everything according to the instructions, Solar 2d did not give errors, just wrote that “WARNING: The ‘plugin.mapbox’ library is not available on this platform.” I compiled the project for Android (7.0), and when I launch the application, I get an error “module ‘plugin.mapbox’ not found: resource (plugin.mapbox.lu) does not exist in archive…” How to solve this? Thank you in advance, you helped me a lot)
I guess you are using the plugin from Solar2d Marketplace, right? This one - https://solar2dmarketplace.com/plugins?MapboxPlugin_scotth-tech
Before @Scott_Harrison arrives for a more detailed response, can you share how you included it in your build.settings
and in code. This could speed things up
Yes, I use this plugin.
Build.setting:
settings =
{
orientation =
{
default = "portrait",
supported = { "portrait", "portraitUpsideDown" },
},
--
-- Android section
--
android =
{
usesPermissions =
{
"android.permission.INTERNET",
},
},
plugins =
{
["plugin.mapbox"] =
{
publisherId="scotth.tech",
supportedPlatforms = {
android = { url="https://solar2dmarketplace.com/marketplacePlugins?ID=my id&plugin=MapboxPlugin_scotth-tech&type=Android"},
}
},
},
--
-- iOS section
--
iphone =
{
xcassets = "Images.xcassets",
plist =
{
UIStatusBarHidden = false,
UILaunchStoryboardName = "LaunchScreen",
},
},
--
-- Project section
--
excludeFiles =
{
-- Exclude unnecessary files for each platform
all = { "Icon.png", "Icon-*dpi.png", "Images.xcassets", },
android = { "LaunchScreen.storyboardc", },
},
}
(Post edited by moderator; Please format code in posts using triple back-ticks to enclose code.; Click pencil icon to review changes and see how coed was reformatted.)
Main.lua:
local mapbox = require ("plugin.mapbox")
local json = require ("json")
mapbox.init("cod")--replace with you access token
local bg = display.newRect( display.contentCenterX, display.contentCenterY, display.actualContentWidth, display.actualContentHeight )
bg:setFillColor( 0, .5, 0)
local title = display.newText( "Тест Карты", display.contentCenterX, 40, native.systemFontBold, 20 )
mapbox.newView({x= display.contentCenterX, y = display.contentCenterY, width = 200, height = 200, listener = function (e)
if (e.type == "obj") then
local mapview =e.obj
mapview:setZoom(0)
end
end
})
if (system.getInfo("environment") == "simulator") then
local notSupported = display.newText( "Не поддерживается в симуляторе", display.contentCenterX, display.contentCenterY, native.systemFont, 13 )
end
(Post edited by moderator; Please format code in posts using triple back-ticks to enclose code.; Click pencil icon to review changes and see how coed was reformatted.)
Let me take a look at this