thaliproject / postcardapp

A sample app to demonstrate how to build Thali applications
MIT License
22 stars 5 forks source link

unable to run postcard app (story_0 branch) #17

Closed mohlsen closed 8 years ago

mohlsen commented 9 years ago

Working off of Story_0 Branch, trying to get the postcard app running on 2 android devices. Following instructions listed in readme from that branch. Here is the console output from the Mac and a screenshot is below taken on Android device (Samsung S6, Lollipop v5.0.2). Attempting to build and deploy from OSX Yosemite.

$ jx --version
v0.10.38
$ cordova -v
5.1.1

Notes: (possible issues and or documentation updated needed)

  1. Step 6 in instructions (jx npm install --production) - line 613 in attachment - needed to call with sudo as it required elevated permissions.
  2. Line 1789 in attachment - failed to install the cordova plugin. Permissions issue again, even though sudo jx npm install --production was used.

It still produced the apk, and I was able to deploy the app to devices, but the app didn't do anything when it started as seen in the screen shots.

I also attached the chrome://inspect debugger to the cordova webview, and did not see any console errors or warning.

s6 postcard

yaronyg commented 9 years ago

The first instruction we gave is to download the zip file. That is a substitute for cloning the branch. In other words there is never a need for you to use 'git clone' just to play with postcardapp. Everything you need is in that zip file. What you have done is essentially put the postcardapp inside of the postcardapp. I'm not quite sure how NPM or Cordova will treat that but my guess is, not well.

So my first advice is to go back to your ~/Development directory and do the curl and unzip there so you have a top level directory that isn't contained in another project that has the postcardapp.

My second advice is that you absolutely should not need to use sudo for jx npm install --production. That strongly indicates that something is very wrong with your Mac setup. You are inside of your home directory so you should have all the permissions you need. I would check the permissions on the components of /Users/mikeohlsen/.jx/npm/npmrc and see if any of them are screwed up. Something is really not right there.

obastemur commented 9 years ago

Also, please update to latest jxcore. Looks like you have 2 versions older.

yaronyg commented 9 years ago

@mohlsen The way to tell what version of JXcore you are running is by executing 'jx -jxv'. You should get back 0.3.0.5. When you run 'jx -v' it tells you what version of node.js it is providing (e.g. that it matches 0.10.x) not what version of the JXcore runtime you are using).

Also I have to admit that I find the install page for jxcore to be really confusing. The right way to install on a Mac is to go to the command line and type in curl http://jxcore.com/xil.sh | bash. That is stated on the install page but every single time I go to that page I end up looking for the Mac section and trying to install the binary directory rather than using that command which is listed on the top.

mohlsen commented 9 years ago

thanks guys. upgraded to latest jxcore (using curl http://jxcore.com/xil.sh | bash) and also nuked the folder and started from scratch. Had to run chown both ~/.npm and ~/.jx to get the permissions corrected. After that, all build well.

postcard instructions were a bit misleading too:

Therefore after cloning this project please:

Made me think that was needed first, before following the instructions below it to download the zip file.

Deployed the app, and after turning on bluetooth (oops!), postcards started showing up from device 1 to device 2, but not the other way around. Then after killing the apps, and trying again, it would not sync at all. So it kinda worked. I have no idea how to go about debugging this or looking for logs.

yaronyg commented 9 years ago

@mohlsen - D'oh! You're absolutely right! I just updated the install instructions for the postcard app to hopefully make them much clearer. Sorry for screwing that up. :(

So it's quite literally impossible for cards to synch from one phone to the other but not the reverse. Not at least unless there is a really nasty bug in here somewhere. There are several reasons for this. First, if Device A connects to Device B then it will do simultaneous push/pull replication which means that as long as there is one connection then everything will sync. Second, @DrJukka put in a nice feature that if Device A connects to Device B over bluetooth, even if Device B never discovered Device A over Wi-Fi Direct (yes, that happens), then Device B still gets a discovery notification and can open its own Bluetooth connection. So if synch is moving in one direction then it has to move in the other.

Which makes me wonder - have you pressed the refresh button in the top right corner? You don't see changes until you hit it.

As for helping us figure out the problem, your logcat logs are very useful here. See the new readme for the postcard app for instructions on how to get the data.

mohlsen commented 9 years ago

thanks @yaronyg. Yes, we were hitting refresh (thats how we saw device 2 get device 1's postcard). Thanks for cleaning up the instructions (next time maybe I'll do a PR), and for adding instructions for logcat. We'll check that out next week.

mohlsen commented 9 years ago

Seeing the same thing today. Device 1 can create postcards, and Device 2 receives them (which clicking refresh). When device 2 creates a postcard, they never show up on device 1 (clicking refresh). See Device 1's logs. and Device 2's logs.

yaronyg commented 9 years ago

So the good news is that discovery works really well on your devices. :)

I opened bug 64 for Matt to investigate this.

But looking at the log what's happening is:

  1. Device 1 successfully discovers and connects to Device 2
  2. Something "bad" happens at the Bluetooth layer and Device 1 losers its connection to Device 2 (that is pretty normal, btw)
  3. This then runs into a bug with our code where, as part of detecting this failure, we close existing connections and retry. The problem is that we attempt to close a connection that is already closed which causes an exception to be thrown. We don't catch that exception so it bubbles to the top of the Node.js runtime and causes the entire runtime to exit.

So the point is that after 9:50:24.741 on device 1 there is no more Node.js runtime. Without a runtime on device 1 it doesn't matter that device 2 is o.k. because it has nobody to talk to!

So first we need to fix bug 64 and then we can try this again. :)

deadlyfingers commented 8 years ago

This refers to the old postcard and should be closed?