Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Error running exported APK — Gideros Forum

Error running exported APK

Hello!

I tried to test my exported apk, trying full export, but I am facing a weird thing: It is crashing... Strange.. because in the export as player I never faced trouble and I thought that'd be the same... Then I tried to open in the android studio to debug and I am having a weird error that I have no any idea why it is happening...
E/AndroidRuntime: FATAL EXCEPTION: GLThread 1104
                  Process: app.paulo.game, PID: 8961
                  com.giderosmobile.android.player.LuaException: Helper/TiledMap.lua:20: attempt to call a nil value
My lua file that is pointing the error is the following:
local map = loadfile(filename)()

does anyone have a light? because in the player i don't have any compilation error pointing "nil" value but why now after apk full exported it is trowing this?

Comments

  • Apollo14Apollo14 Member
    edited May 2018
    Is it crashing on the start?

    It is a good practice to make essential variables safe after we load them, like:
    coinsTotal = dataSaver.loadValue("coinsTotal")
    if coinsTotal==nil then
        coinsTotal=0
    end
    Maybe you could find what variable is nil, and make it safe to work with.
    (I'm not sure if it helps, I'm also newbie in debugging)

    In your case you can write:
    local map = loadfile(filename)()
    if map==nil then
    map=yourSafeValue
    end

    Likes: Paulo777

    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
    +1 -1 (+1 / -0 )Share on Facebook
  • hgy29hgy29 Maintainer
    Accepted Answer
    Maybe you forgot to ‘exclude from compilation’ the file you are trying to load dynamically ?
  • Paulo777Paulo777 Member
    edited May 2018
    hgy29 said:

    Maybe you forgot to ‘exclude from compilation’ the file you are trying to load dynamically ?

    @hgy29 Do you mean "exclude from execution"?
    I tried to do that and then export it again but nothing... same thing.
  • Paulo777Paulo777 Member
    edited May 2018
    Apollo14 said:

    Is it crashing on the start?

    It is a good practice to make essential variables safe after we load them, like:

    coinsTotal = dataSaver.loadValue("coinsTotal")
    if coinsTotal==nil then
        coinsTotal=0
    end
    Maybe you could find what variable is nil, and make it safe to work with.
    (I'm not sure if it helps, I'm also newbie in debugging)

    In your case you can write:
    local map = loadfile(filename)()
    if map==nil then
    map=yourSafeValue
    end
    @Apollo14 I don't know what 'safe value' I could set to a variable... it is a tiledMap configuration. I load a map in it.

    Yes, in the app launch It stops
  • SinisterSoftSinisterSoft Maintainer
    This is better...
    coinsTotal = dataSaver.loadValue("coinsTotal") or 0
    and
    local map = loadfile(filename)() or yourSafeValue

    Likes: Apollo14

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+1 / -0 )Share on Facebook
  • This is better...

    coinsTotal = dataSaver.loadValue("coinsTotal") or 0
    and
    local map = loadfile(filename)() or yourSafeValue
    @SinisterSoft thank you for the answer, but I load a map in the tiledmap. I don't know what 'safe value' I could set. Can I declare inside a loop while not nil? Don't know
  • antixantix Member
    Accepted Answer
    Maybe you should check your filename. Gideros player doesn't care about case errors in filenames.. but on export.. the device DOES care about case errors with filenames. This is one of the most annoying things I find in Gideros :D
    +1 -1 (+2 / -0 )Share on Facebook
  • antix said:

    Maybe you should check your filename. Gideros player doesn't care about case errors in filenames.. but on export.. the device DOES care about case errors with filenames. This is one of the most annoying things I find in Gideros :D

    @antix I thought EXACTLY on that. Then I changed the names of my png files that the tiledmap calls, one is for "clouds.png", the other for "groud_small.png". But it still keeps throwing me the error. Is anything wrong? I mean it does accept "_"... and in my folders there is no "_" in any folder names just unique name.
  • Paulo777Paulo777 Member
    edited May 2018
    I set the file "Exclude from execution" now it works @antix @hgy29

    It compiled successfully on android studio :smiley:
    +1 -1 (+2 / -0 )Share on Facebook
  • SinisterSoftSinisterSoft Maintainer
    Aside from this, why do you still use Android Studio rather than the built-in apk creation?

    Likes: Paulo777

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+1 / -0 )Share on Facebook
  • SinisterSoftSinisterSoft Maintainer
    If you map loader results in a table being returned then just provide the table as the other answer,
    local map = loadfile(filename)() or {} -- in the table here put 'default' map data

    Likes: Paulo777

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+1 / -0 )Share on Facebook
  • Paulo777Paulo777 Member
    edited May 2018

    Aside from this, why do you still use Android Studio rather than the built-in apk creation?

    @SinisterSoft I tried but App Crashed... Then I imported it to android studio to debug and figure out why it was going on. But the tip of @hgy29 worked for me to "exclude from execution" the lua file containing map informations. Don't know why but it worked :smiley:

    by the way, now every change I make in gideros I'm exporting as "assets only" and debuging on android studio, this is working perfectly
Sign In or Register to comment.