I am getting a strange error regarding running my app on a device. I am developing my app for android only
The app works fine on Simulator but throws up the following error on an android device:-
/Users/jenkins/slaveroot/workspace/Templates/label/android/platform/resources/json.lua:26:json.decode called with nil string
I have stripped down my app to just Main.lua with only a image and the following code. This is the piece of code that is causing this error.
display.setStatusBar( display.HiddenStatusBar ) -- require the composer library local composer = require "composer" -- load scene1 local utility = require("lib.utility") -- Add any objects that should appear on all scenes below (e.g. tab bar, hud, etc) local user = utility.loadTable("user.json") if user == nil then user = {} user.lives = 5 user.money = 50 user.currentlevel = 1 user.levels = {} user.levels[1] = {} user.levels[1].firsttime = true user.levels[1].tut = false user.levels[1].locked = false user.levels[1].score = 0 user.levels[1].star = 0 ------------------1 is locked, 2 is open, 3 is 1 star, 4 is 2 star and 5 is 3 star------------- for i=2,10 do user.levels[i] = {} user.levels[i].firsttime = true user.levels[i].locked = true user.levels[i].score = 0 user.levels[i].star = 0 end user.dipper = 1 user.moremoves = 5 user.bee = 5 user.hand = 5 user.hammer = 5 user.musictoggle = 1 ---------o is off and 1 is on----------------- user.soundtoggle = 1 ---------o is off and 1 is on----------------- --user.isPaid = false user.unlockedLevels = 20 user.bestScore = 0 user.firsttime = 0 utility.saveTable(user, "user.json") utility.loadTable(user, "user.json") end print("money: "..user.money) composer.gotoScene( "title")
I am at my wit’s end. What do I do?
P.s utility is the external library that deals with loading and saving json files.
