MoaiNao: run your script on android without building

A place for developers to promote games they have created with Moai.

Moderator: ezraanderson

MoaiNao: run your script on android without building

Postby thebullno1 » Mon Apr 16, 2012 7:50 pm

Building for Android has not been pleasant. It takes quite an amount of time for big projects. Simulators are not perfect. That's why I created MoaiNao to make on device testing easier.

Download

How to use:
Prerequisites
  1. Install MoaiNao-debug.apk
  2. Make an adb connection either through wifi or usb
  3. Make sure that usb mass storage is off or the device is in MTP mode

The slow way:
  1. Zip your project files such that main.lua is at the root of the archive (refer to sample-project/sample.moai)
  2. Change the extension to .moai
  3. Copy the file to somewhere you can reach in your sdcard
  4. Use a file manager to locate and open the file
  5. Choose Moai Nao (portrait) or Moai Nao (landscape)

The quick way:(it is faster in the long run, just a bit of initial setup)
  1. Make sure 7z.exe (http://www.7-zip.org/) is in your PATH
  2. Give your project a structure similar to sample-project
  3. Edit settings.bat to change the bundle name
  4. Adjust the path in include.txt
  5. Edit launch-on-device.bat to match your desired orientation (instructions provided in the file)
  6. Run deploy-to-device.bat everytime you want to test on device
  7. Cheeze burgerzzz ... errr, I mean profit!! :)

What the scripts do:
  • settings.bat edit this to change your bundle name
  • launch-on-device.bat simply launchs MoaiNao on the device and makes it open your bundle. Use this script whenever you want to relaunch your app and do not want to repackage resources (nothing is changed since the last run)
  • deploy-to-device.bat packages your resources using include.txt and exclude.txt as input, pushes it to your device using adb push and then calls launch-on-device.bat

Other notes:
  • deploy-to-device pushes your .moai file to /data/local/tmp so there's no guarantee that it will stays there
  • All your bundles are run under the same app (MoaiNao) so they share the document and cache directory, remember to clean it if you use MoaiNao for multiple bundles. "Moai Nao Settings" inside the app drawer redirects you to the setting page to do this.
  • deploy-to-device.bat use update mode (the u parameter) for fast updating of the archive. It does not take into account deleted files. Delete your local .moai file for a full repackage.
  • Please pardon my lol-cat-lish

Future work:
  • Investigate adb sync for even faster update.

A github project will be set up soon.

Haz fun nao, bai.
User avatar
thebullno1
 
Posts: 319
Joined: Sat Jul 02, 2011 8:53 am

Re: MoaiNao: run your script on android without building

Postby todd » Fri Apr 20, 2012 6:22 pm

Thanks - this is awesome! We are going to fire it up and try it here! :D
User avatar
todd
 
Posts: 262
Joined: Fri Mar 25, 2011 1:11 pm

Re: MoaiNao: run your script on android without building

Postby thebullno1 » Tue May 01, 2012 10:00 am

todd wrote:Thanks - this is awesome! We are going to fire it up and try it here! :D

Glad to hear that. Does it work for you?

Github project is up: https://github.com/bullno1/MoaiNao
User avatar
thebullno1
 
Posts: 319
Joined: Sat Jul 02, 2011 8:53 am

Re: MoaiNao: run your script on android without building

Postby dooms101 » Thu May 31, 2012 1:12 am

This is a great contribution to the community! It makes testing on my Android phone super easy and I can call it with a short keystroke in Sublime 2. How do you set this up with the decoda debugger? It would be great to have a debugger integrated into some sort of IDE.
User avatar
dooms101
 
Posts: 74
Joined: Tue May 01, 2012 7:04 pm
Location: Appalachian State University

Re: MoaiNao: run your script on android without building

Postby nosheet » Sat Jun 02, 2012 1:48 am

This looks great. Would this theoretically work on OSX too, provided that the proper shell scripts would be written instead of .bat files, or there are limitations - I've seen that file transfer between OSX and android devices is very quirky to say at least. Did anybody try this on OSX ?
Thanks :)
A few games I've made, just before I stopped making them:
http://www.spin-up-game.com and http://www.foosballhero.com
User avatar
nosheet
 
Posts: 424
Joined: Mon May 28, 2012 2:40 pm
Location: Madrid, Spain

Re: MoaiNao: run your script on android without building

Postby thebullno1 » Sun Jun 03, 2012 3:33 am

dooms101 wrote:This is a great contribution to the community! It makes testing on my Android phone super easy and I can call it with a short keystroke in Sublime 2. How do you set this up with the decoda debugger? It would be great to have a debugger integrated into some sort of IDE.

Decoda is designed to debug a Windows program by hooking to the lua state (which it finds using the pdb file). It will not work for Android.

This looks great. Would this theoretically work on OSX too, provided that the proper shell scripts would be written instead of .bat files, or there are limitations - I've seen that file transfer between OSX and android devices is very quirky to say at least. Did anybody try this on OSX ?
Thanks

It should work in theory. All I did was zipping the resources and send it to the device. 7z was used since I find it easy to configure. 7z should work on Mac too.
User avatar
thebullno1
 
Posts: 319
Joined: Sat Jul 02, 2011 8:53 am

Re: MoaiNao: run your script on android without building

Postby shrike » Sun Dec 09, 2012 10:10 am

Hi, I've tried to make moai run on android but without any success... First I've tried from Mac OS using the host provided with MOAI sdk. Then I've tried with your MoaiNao build, but again without any result.

When I execute "launch-on-device.bat" I just get a black screen for a while. That's the output of logcat that seems to be related with the execution:

I/MoaiLog (10786): Loading libmoai.so
I/MoaiLog (10786): MoaiActivity onCreate: activity CREATED
I/MoaiLog (10786): MoaiCrittercism onCreate: Initializing Crittercism
I/MoaiLog (10786): MoaiFacebook onCreate: Initializing Facebook
I/MoaiLog (10786): MoaiGoogleBilling onCreate: Initializing Google Billing
I/MoaiLog (10786): MoaiGooglePush onCreate: Initializing Google Push
I/MoaiLog (10786): MoaiTapjoy onCreate: Initializing Tapjoy
I/DEBUG ( 223): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 223): Build fingerprint: 'samsung/GT-P7310/GT-P7310:3.2/HTJ85B/XXKJ4:user/release-keys'
I/DEBUG ( 223): pid: 10786, tid: 10786 >>> com.bullno1.moainao <<<
I/DEBUG ( 223): signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 81ba3c88
I/DEBUG ( 223): r0 00000000 r1 00000000 r2 81a683f4 r3 81a6851c
I/DEBUG ( 223): r4 becd32c8 r5 00000000 r6 7f800000 r7 42c80000
I/DEBUG ( 223): r8 00001cec r9 81d0fd90 10 00002440 fp fffffe90
I/DEBUG ( 223): ip 00000000 sp becd32b8 lr 81a6ee64 pc 81ba3c88 cpsr 60000010
I/DEBUG ( 223): d0 4060200000000000 d1 3ff0000043295555
I/DEBUG ( 223): d2 4e166fea42be891d d3 42c8000000650ff0
I/DEBUG ( 223): d4 4179f4c660000000 d5 4068e00000000000
I/DEBUG ( 223): d6 000000c77bd8ba27 d7 0000000000000000
I/DEBUG ( 223): d8 0000000000000000 d9 0000000000000000
I/DEBUG ( 223): d10 0000000000000000 d11 0000000000000000
I/DEBUG ( 223): d12 0000000000000000 d13 0000000000000000
I/DEBUG ( 223): d14 0000000000000000 d15 0000000000000000
I/DEBUG ( 223): scr 60000012
I/DEBUG ( 223):
I/DEBUG ( 223): #00 pc 003a3c88 /data/data/com.bullno1.moainao/lib/libmoai.so (cosf)
I/DEBUG ( 223): #01 lr 81a6ee64 /data/data/com.bullno1.moainao/lib/libmoai.so
I/DEBUG ( 223):
I/DEBUG ( 223): libc base address: aff00000
I/DEBUG ( 223):
I/DEBUG ( 223): code around pc:
I/DEBUG ( 223): 81ba3c68 e92d4010 ec510b30 ebf63947 ec410b30
I/DEBUG ( 223): 81ba3c78 eef77be0 ee170a90 e8bd8010 ee070a90
I/DEBUG ( 223): 81ba3c88 eef70ae7 e92d4010 ec510b30 ebf63bde
I/DEBUG ( 223): 81ba3c98 ec410b30 eef77be0 ee170a90 e8bd8010
I/DEBUG ( 223): 81ba3ca8 ee070a90 eef70ae7 e92d4010 ec510b30
I/DEBUG ( 223):
I/DEBUG ( 223): code around lr:
I/DEBUG ( 223): 81a6ee44 e59d1000 e28dd008 ea04d39e e92d4070
I/DEBUG ( 223): 81a6ee54 e1a04000 e1a00001 e1a05001 eb04d387
I/DEBUG ( 223): 81a6ee64 e1a06000 e1a00005 eb04d2ec e5846000
I/DEBUG ( 223): 81a6ee74 e5840004 e1a00004 e8bd8070 e24dd008
I/DEBUG ( 223): 81a6ee84 e92d4010 ed2d8b08 e24dd008 ed9daa0e
I/DEBUG ( 223):
I/DEBUG ( 223): stack:
I/DEBUG ( 223): becd3278 001d7460
I/DEBUG ( 223): becd327c 00000000
I/DEBUG ( 223): becd3280 0000001b
I/DEBUG ( 223): becd3284 aff46454
I/DEBUG ( 223): becd3288 001d7470
I/DEBUG ( 223): becd328c 00000000
I/DEBUG ( 223): becd3290 00001cec
I/DEBUG ( 223): becd3294 81d0fd90
I/DEBUG ( 223): becd3298 00002440
I/DEBUG ( 223): becd329c aff13393 /system/lib/libc.so
I/DEBUG ( 223): becd32a0 00001cec
I/DEBUG ( 223): becd32a4 81d0fd90
I/DEBUG ( 223): becd32a8 00002440
I/DEBUG ( 223): becd32ac 00000001
I/DEBUG ( 223): becd32b0 df002777
I/DEBUG ( 223): becd32b4 e3a070ad
I/DEBUG ( 223): #00 becd32b8 becd32c8
I/DEBUG ( 223): becd32bc 001d40a0
I/DEBUG ( 223): becd32c0 7f800000
I/DEBUG ( 223): becd32c4 81a68508 /data/data/com.bullno1.moainao/lib/libmoai.so
I/DEBUG ( 223): becd32c8 42c80000
I/DEBUG ( 223): becd32cc 00001cec
I/DEBUG ( 223): becd32d0 81d0fd90
I/DEBUG ( 223): becd32d4 001d40a0
I/DEBUG ( 223): becd32d8 00000000
I/DEBUG ( 223): becd32dc 81a685f0 /data/data/com.bullno1.moainao/lib/libmoai.so
I/DEBUG ( 223): becd32e0 7f800000
I/DEBUG ( 223): becd32e4 001d40a0
I/DEBUG ( 223): becd32e8 81a6ae0c /data/data/com.bullno1.moainao/lib/libmoai.so
I/DEBUG ( 223): becd32ec 81a68660 /data/data/com.bullno1.moainao/lib/libmoai.so
I/DEBUG ( 223): becd32f0 001d4028
I/DEBUG ( 223): becd32f4 00000000
I/DEBUG ( 223): becd32f8 81a6ae0c /data/data/com.bullno1.moainao/lib/libmoai.so
I/DEBUG ( 223): becd32fc 81a6b710 /data/data/com.bullno1.moainao/lib/libmoai.so
I/DEBUG ( 223): dumpstate /data/log/dumpstate_app_native.txt
shrike
 
Posts: 27
Joined: Thu Nov 01, 2012 11:32 pm

Re: MoaiNao: run your script on android without building

Postby thebullno1 » Sun Dec 09, 2012 10:14 am

This is the release build. There's no debug symbol so there's not much I can tell from this crash log. Can you make a debug build of MoaiNao and test it?

Edit: after a bit of googling, I found this: http://www.codedojo.com/?p=1509
You should upgrade your ndk and build a new MoaiNao. I remembered creating the binary with an old NDK.
User avatar
thebullno1
 
Posts: 319
Joined: Sat Jul 02, 2011 8:53 am

Re: MoaiNao: run your script on android without building

Postby shrike » Sun Dec 09, 2012 11:07 am

Thanks a lot! I'll give it a try as soon as possible and I'let you know about the results!
shrike
 
Posts: 27
Joined: Thu Nov 01, 2012 11:32 pm


Return to Made With Moai

Who is online

Users browsing this forum: No registered users and 0 guests

cron

x