Quick Links: Gideros Home | Download Gideros | Developer Guide
ZBS + Gideros - can't debug/run as scratchpad on real device
  • snooks +1 -1
    Member
    I am using the live-coding-simple Gideros project in ZeroBrane Studio. It works perfectly with the local Gideros player.

    However I am unable to either debug or Run as Scratchpad on a real (Android) device. The project uploads to the Gideros player on the device, but the debugger doesn't connect.

    I'd be grateful for any advice re troubleshooting this.

    Thanks in advance.

    Gideros Studio 2017.6.3
    ZeroBrane Studio (1.60; MobDebug 0.648)
    Windows 10
  • keszegh +1 -1
    Member
    i did not try live coding since some time. but i use zbs debugging daily, my setup is the following (assuming my android device is on ip 192.168.1.29):
    --[[ 
    Details of the implementation:
    http://giderosmobile.com/forum/discussion/comment/12833
    http://giderosmobile.com/forum/discussion/comment/12680
     
    [set remote debugging 29](macro:shell(ide.config.gideros = {remote = "192.168.1.29"}))
    [set local debugging nil](macro:shell(ide.config.gideros = nil))
    --]]

     
     
    if pcall(require, 'mobdebug')
    then
    mobd=require('mobdebug').start("192.168.0.11") --this ip should be the ip of your pc
    print("debugging on")
    end


    note that the --[[...]]-- part will change how it looks in zbs.
    then if you want to debug run on device, then click on 'set remote debugging 29' and run your project, it should work.

    you should put into your project (without execution) the mobdebug file found in one of the zbs directories.

    let me know if you succeed, then we can proceed with live coding too if that remains to be a problem.
  • snooks +1 -1
    Member
    Ahh, thanks very much. The general debug issue was not putting in the PC IP address in the mobdebug start command. I was putting in the Android IP, as well as running the macro to set the remote IP address.

    That has been successful, but live coding is still only working with the local player. When targeting the device and clicking on the Run as Scratchpad icon, normal debugging starts.

    Thanks again for your help, a final push to get live coding working on device would be great!
  • keszegh +1 -1 (+1 / -0 )
    Member
    you can look up also my tutorial:
    http://www.indiedb.com/tutorials/gideros-with-zerobrane

    for live coding try the following (which works for me):
    given a project set up such that debugging works, make sure that there is some function added to eventlistener, otherwise scratchpad won't work.

    e.g. you can add the following:
    function liveupdate(self)
    print("")
    end
     
    stage:addEventListener(Event.ENTER_FRAME, function(s) pcall(liveupdate, s) end, self)


    if you run this as scratchpad, then during running you can change what is printed and it should update live. of course should work with any other function you put instead of print. also, sending 'self' as a parameter is completely irrelevant in this example.

    if you want to liveupdate someFunction of someClass, then rename the someFunction function to someFunctionLive and add the following code:
     
    stage:addEventListener(Event.ENTER_FRAME, function() end, nil) --this function is necessary as i said at the beginning
     
    someClass:someFunction()
    pcall(someClass.someFunctionLive, self)
    end


    of course you can see the results of the changes you make in your function only when it is called.

    remark: pcall(self.someFunctionLive, self) seems not to work for some reason (at least the last time i tried a long time ago).

    Likes: snooks

  • keszegh +1 -1 (+1 / -0 )
    Member Accepted Answer
    i forgot to test on device. now i did and it seems that if i run it on device then no typing is allowed in zbs while running. so my last post only works on desktop player for some reason.
    @paulclinger, the author of zbs can perhaps help us out.

    Likes: snooks

  • snooks +1 -1 (+1 / -0 )
    Member
    Thanks very much, that was a great tip with going through a secondary method with objects, without it live coding appears to work (left and right arrows above numbers for example), but doesn't do anything.

    It's good that you can replicate it not working on a device too.

    I've came across another issue, which is something to do with how '-'s are being parsed. I get these kind of errors involving minus symbols...
    Scratchpad error on line 1:
    [string "(function() - local debug ..."]:1: unexpected symbol near '-'


    I first noticed it when doing the Lua commenting out comments thing...
    --[[
    --]]

     
    -- ^ that's okay but
     
    ---[[
    --]]
     
    -- ^ this produces an error similar to the one above. Also I had this issue with the Tiled
    -- example, where at some point this error was thrown with the lines...
     
    print('-------------------------------------------------')


    But apart from these niggles this live coding thing is fantastic. Gideros and ZBS both seem very solid.

    Likes: antix

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with OpenID

In this Discussion

Top Posters