B4J Question [SOLVED] Can't find variable: google

makis_best

Well-Known Member
Licensed User
Longtime User
I have made a simple google map application show some markers using @Erel example.
Until today the application was working fine.

Now I get the error

I didn't change anything on my code but I get that error.
Why?

jFX 7.50
jGoogleMaps 1.81
 

Harris

Expert
Licensed User
Longtime User
Supply the code from Main...
Thanks
 
Upvote 0

makis_best

Well-Known Member
Licensed User
Longtime User
Supply the code from Main...
Thanks
B4X:
    MainForm = Form1
    MainForm.Show
    MainForm.RootPane.LoadLayout("1") 'Load the layout file.
    DatePicker1.DateFormat = "dd/MM/yyyy"
    MarkerList.Initialize
    Dim url As String
    url = "jdbc:sqlserver://xxxxxxxxx;integratedSecurity=false;databaseName=xxxxxx;"
    sql1.Initialize2("com.microsoft.sqlserver.jdbc.SQLServerDriver",url, "xxx", "xxxxxxx")
    Dim rs As ResultSet = sql1.ExecQuery("SELECT Code, Name FROM SFIS WHERE fCommercialUnitCode = '001' ORDER BY Code")
    ComboBox1.Items.Add("Όλοι")
    Do While rs.NextRow
        ComboBox1.Items.Add(rs.GetString("Code") & " - " & rs.GetString("Name"))
    Loop
    rs.Close
    ComboBox1.SelectedIndex = 0

    options.StreetViewControl = False
    gmap.Initialize2("gmap", options, "xxxxxxxxxxxxxxxxxxxxx")
    Pane1.AddNode(gmap.AsPane, 0, 0, Pane1.Width, Pane1.Height)
    MarkerInfos.Initialize
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
Error occurred on line: 163 (Main) - don't see this with what you supplied...
 
Upvote 0

makis_best

Well-Known Member
Licensed User
Longtime User
Error occurred on line: 163 (Main) - don't see this with what you supplied...

Sorry wrong copy paste
B4X:
Sub ComboBox1_SelectedIndexChanged(Index As Int, Value As Object)
    If MarkerList.Size > 0 Then
        For i = 0 To MarkerList.Size - 1
            gmap.RemoveMarker(MarkerList.Get(i))
        Next
        MarkerList.Clear
    End If
    Dim Cb As String
    Cb = ComboBox1.Value
    If Cb = "Όλοι" Then
        Cb = "%"
    Else
        Cb = Cb.SubString2(0,3).Trim
    End If
    Dim Dt1 As String = DateTime.Date(DatePicker1.DateTicks)
    Dim SqlScript As String
    SqlScript = $"SELECT * FROM GPS"$
    Dim rs As ResultSet = sql1.ExecQuery(SqlScript)
    Do While rs.NextRow
        Dim Lo, La As Double
        Lo = rs.GetDouble("Long")
        La = rs.GetDouble("Lang")
        Dim m As Marker = gmap.AddMarker(Lo, La, "Ώρα: " & rs.GetString("Time1")) ---->  Here the code stop
        AttachInfoWindow(m, "Proof: " & rs.GetString("SM"))
        MarkerList.Add(m)
    Loop
    rs.Close
End Sub
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
AddMarker( Lat, Lon, "Title") looks like you use - lon, lat as param...

Also, do you have an API key for google map?
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
Try logging results... Catch the error!

B4X:
Do While rs.NextRow
        Dim Lo, La As Double
        Lo = rs.GetDouble("Long")
        La = rs.GetDouble("Lang")
        
        
        ' Log the vars and see what you get...
        Log( "Lat: "&La& "  Long: "&Lo &"  Time1: "&rs.GetString("Time1") )
        
       Try 
           Dim m As Marker = gmap.AddMarker(Lo, La, "Ώρα: " & rs.GetString("Time1")) ---->  Here the code stop
       Catch
           Log(" Last Error: "&LastException.Message)
        End Try

        AttachInfoWindow(m, "Proof: " & rs.GetString("SM"))
        MarkerList.Add(m)
    Loop
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
"google" is google's map api's master object. if it is not found, it means the api was not downloaded successfully from google. why this has happened is hard to say, but downloading the api does not depend on having an api key. (using the api, on the other, hand, would require a valid key). if, in fact, you have changed nothing, then something has changed on the other end (or possibly on your network's end).

for example, i can make a similar error occur simply by not being online when using a google-related map app of mine, thus causing the download to fail and references to "google" throw an error. i'm not suggesting you are not online; i am just telling you what "google" means.
 

Attachments

  • google.png
    3.6 KB · Views: 197
Upvote 0

josejad

Expert
Licensed User
Longtime User
Could it be related with this?
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
certainly one possibility (if not the actual reason). always good to have a backup plan. also doesn't hurt to know what "google not found" means. saludos, jja
 
Upvote 0

makis_best

Well-Known Member
Licensed User
Longtime User
After I wait for a day and after I clean project then
I get the same error but on different line
B4X:
infoWindow.InitializeNewInstance("com.lynden.gmapsfx.javascript.object.InfoWindow", Null)
 
Upvote 0

makis_best

Well-Known Member
Licensed User
Longtime User
I check com.lynden.gmapsfx.javascript.object and I can't see any last change or update but the problem exist
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…