Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Runtime error in example app in android build
Started by mitonj Feb 10 2019 03:32 AM

13 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

mitonj

[GLOBAL: userInfoPane.html]
mitonj
  • Observer

  • 7 posts
  • Corona SDK

Hi!

I'm trying to build app from tutorial on android and get runtime error on device.

Here is the console log:

 
Feb 10 01:22:44.269 ----------  Device Log Starts  ----------
Feb 10 01:22:44.535 PH-1: Request to r
Feb 10 01:22:44.536 emove task ignored for non-existent task 450
                    PH-1: Platform: PH-1 / ARM Neon / 9 / Adreno (TM) 540 / OpenGL ES 3.2 V@319.0 (GIT@5a7aebc, Ie87d5dfbba) (Date:07/05/18) / 2018.3326 / English | US | en_US | en
                    PH-
Feb 10 01:22:44.536 1: WARNING: menu.lua:29: Failed to find image 'background.png'
Feb 10 01:22:44.536 PH-1: ERROR: Runtime error
Feb 10 01:22:44.536 PH-1: menu.lua:30
Feb 10 01:22:44.545 : attempt to index local 'background' (a nil value)
                    PH-1: stack traceback:
                    PH-1:  menu.lua:30: in function 'method'
                    PH-1:  /U
Feb 10 01:22:44.545 sers/jenkins/slaveroot/workspace/Templates/label/android/platform/resources/init.lua:221: in function 'dispatchEvent'
                    PH-1:  /Users/jenkins/slaveroot/workspace/Templates/label/android/subrepos/composer/composer.lua:1470: in function 'gotoScene'
                    PH-1:  main.lua:16: in main chunk
Feb 10 01:22:44.545 PH-1: ERROR: Runtime error
Feb 10 01:22:44.545 PH-1: menu.lua:30: attempt to index local 'background' (a nil value)
                    PH-1: stack traceback:
                    PH-1:  [C]: ?
                    PH-1:  menu.lua:30: in function 'method'
                    PH-1:  /Users/jenkins/slaveroot/workspace/Templates/label/android/platform/resources/init.lua:221: in function 'dispatchEvent'
                    PH-1:  /Users/jenkins/slaveroot/workspace/Templates/label/android/subrepos/composer/composer.lua:1470: in function 'gotoScene'
                    PH-1:  main.lua:16: in main chunk
Feb 10 01:23:05.219 ---------- Device Log Finished ----------

It looks like that assets is not in build itself. But I don't get why is it happen.

 



[TOPIC: post.html]
#2

agramonte

[GLOBAL: userInfoPane.html]
agramonte
  • Corona Geek

  • 1,043 posts
  • Corona SDK

do you still have this file:

 

 

1: WARNING: menu.lua:29: Failed to find image 'background.png'

 

It looks like it isn't in your project folder. It should be spelled exactly the same. If you can't find it just place some other image and name it that or change your code so you don't access that file.



[TOPIC: post.html]
#3

mitonj

[GLOBAL: userInfoPane.html]
mitonj
  • Observer

  • 7 posts
  • Corona SDK

do you still have this file:

 

It looks like it isn't in your project folder. It should be spelled exactly the same. If you can't find it just place some other image and name it that or change your code so you don't access that file.

It's in project folder and it works in corona simulator but after building it into apk this happens. 



[TOPIC: post.html]
#4

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 616 posts
  • Corona SDK

Like I mentioned in another active thread, you are probably experiencing this issue due to a typo.

If the file is there and it works on the simulator, but not on Android, then ThE iSsUE iS ProBAbly AbOUt cAsE senSITivitY. Android is a case sensitive system.

Make sure that the filename is exactly the same in the folder and in your code, e.g. make sure that one of them isn't "Backgound.png" and the other one is "background.png". When in doubt, go all lowercase.



[TOPIC: post.html]
#5

mitonj

[GLOBAL: userInfoPane.html]
mitonj
  • Observer

  • 7 posts
  • Corona SDK

Like I mentioned in another active thread, you are probably experiencing this issue due to a typo.

If the file is there and it works on the simulator, but not on Android, then ThE iSsUE iS ProBAbly AbOUt cAsE senSITivitY. Android is a case sensitive system.

Make sure that the filename is exactly the same in the folder and in your code, e.g. make sure that one of them isn't "Backgound.png" and the other one is "background.png". When in doubt, go all lowercase.

 

Yeah, i've read about this and all well here. The name is in lower case and the same in folder and in code. I even tried to copy/paste name of the file one more time. 



[TOPIC: post.html]
#6

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 616 posts
  • Corona SDK

If your project isn't large, you could consider uploading it here and someone can better help you identify the issue that way.



[TOPIC: post.html]
#7

mitonj

[GLOBAL: userInfoPane.html]
mitonj
  • Observer

  • 7 posts
  • Corona SDK

If your project isn't large, you could consider uploading it here and someone can better help you identify the issue that way.

As I said it is an example project from tutorial which I just want to try build. I'm building it without any changes in assets and code. So here is archive you can try to build. 

 

I'm trying to build it on macOS Mojave 10.14

 

Archive is too big. Loaded on drive.

https://drive.google.com/open?id=1IZ559Bz2gkZLoy9V7rkv4Rz9B2qH0XCZ



[TOPIC: post.html]
#8

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 616 posts
  • Corona SDK

Well, that's great, but what tutorial are you referring to? Please provide a link to it. There tens of possible tutorials you may be referring to on Corona's site alone. If you found the tutorial on some other site, then we are talking about thousands of possibilities.

Again, the reason why I asked you to consider uploading your project was that since it is based on some tutorial, there shouldn't be anything proprietary there that you would need to protect. Furthermore, I have seen countless cases where someone has "copied source directly, but the code still doesn't work", which is usually because the code source or other files were not in fact copied as is, but some changes were made.

But, in this case, point me to the tutorial and I'll see if I can build it without issues.



[TOPIC: post.html]
#9

mitonj

[GLOBAL: userInfoPane.html]
mitonj
  • Observer

  • 7 posts
  • Corona SDK

Well, that's great, but what tutorial are you referring to? Please provide a link to it. There tens of possible tutorials you may be referring to on Corona's site alone. If you found the tutorial on some other site, then we are talking about thousands of possibilities.

Again, the reason why I asked you to consider uploading your project was that since it is based on some tutorial, there shouldn't be anything proprietary there that you would need to protect. Furthermore, I have seen countless cases where someone has "copied source directly, but the code still doesn't work", which is usually because the code source or other files were not in fact copied as is, but some changes were made.

But, in this case, point me to the tutorial and I'll see if I can build it without issues.

This one. The tutorial from getting started section of corona docs. I was step-by-step copy/pasted the code from the tutorial. My full project in my previous message on google drive. 

https://docs.coronalabs.com/guide/programming/02/index.html



[TOPIC: post.html]
#10

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 616 posts
  • Corona SDK

On that specific page, you have a notification that reads:

"For reference purposes, the program up to this point is available here. If your project doesn't behave as expected, please compare this source code with your own."

There's a similar notification on every subsequent chapter that also includes a link to the source files up to that specific chapter. Before I take a swing at that, have you tried downloading those source files and building for Android using them?



[TOPIC: post.html]
#11

mitonj

[GLOBAL: userInfoPane.html]
mitonj
  • Observer

  • 7 posts
  • Corona SDK

On that specific page, you have a notification that reads:

"For reference purposes, the program up to this point is available here. If your project doesn't behave as expected, please compare this source code with your own."

There's a similar notification on every subsequent chapter that also includes a link to the source files up to that specific chapter. Before I take a swing at that, have you tried downloading those source files and building for Android using them?

 

Yeah, the one downloaded from tutorial source is building well. 

But I'm checking code and it is similar. 



[TOPIC: post.html]
#12

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 616 posts
  • Corona SDK

Well, at least now we know that the tutorial itself isn't the problem, which is good. But then we get to the grueling part, which is: "everything is supposed to work, but somehow it isn't."

There may be a typo somewhere in the code or with some file, or there may be some Mac specific issue that I have no clue about. I also took a quick glance at the build.settings files and your version has a lot of extra content that the tutorial's version doesn't have. Perhaps your culprit is hidden there? Try switching the build.settings and see if it works then.



[TOPIC: post.html]
#13

mitonj

[GLOBAL: userInfoPane.html]
mitonj
  • Observer

  • 7 posts
  • Corona SDK

Well, at least now we know that the tutorial itself isn't the problem, which is good. But then we get to the grueling part, which is: "everything is supposed to work, but somehow it isn't."

There may be a typo somewhere in the code or with some file, or there may be some Mac specific issue that I have no clue about. I also took a quick glance at the build.settings files and your version has a lot of extra content that the tutorial's version doesn't have. Perhaps your culprit is hidden there? Try switching the build.settings and see if it works then.

Yeah, 

I've tried to switch build.settings file and all worked. Thanks for help and patience :)

 

Now will try to give it a close look on my build.settings to find out what is the cause of build problem. 



[TOPIC: post.html]
#14

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 616 posts
  • Corona SDK

No problem. Remember, one like per day keeps the bugs away. :P

Nah, but on a more serious note, this was one of those issues that would have been very difficult to solve without having access to your project. Especially since the real culprit was in a different file than where the problem was believed to be.




[topic_controls]
[/topic_controls]