2014년 12월 10일 수요일

App Inventor 2 Emulator

Hi, I am high school teacher and I am having trouble connecting the emulator to App Inventor in my school.

I currently have the latest version of the AIStarter.  

The emulator is looping between "Companion App Starting" and "Verifying the Companion App". I have made sure that any website that my machine is reaching out to is unblocked on the server, along with creating specific rules to open possible ports (8001, 5554 and 5037). If there is a way to find out all specific resources that both the emulator, and the App Inventor Site are accessing, I may be able to pinpoint why these two items are not communicating. 



Firewalls prevent the emulator and WIFI from communicating in public places like hotels, hospitals with Internet access and you probably have a firewall issue Tony on your school network.
AI2 uses port 8004.

Have you visited this page http://appinventor.mit.edu/explore/ai2/support/troubleshooting.html   ?      It may have the hint you need to move on.   If it does not help, ask again.



I assumed that was the problem. Is there a list of specific sites that these programs "talk to"? I have admin right and can allow these sites through so that my students can use this program? 



Not sites Tony, port 8004 has to be available for AI2 to use.



I just checked and port 8004 is not being used. I also created both an inbound and outbound rule allowing the use of port 8004 and still no luck. 



When I run AI2, it is running in the 8004 port. However, my blocks are not being loaded to the emulator. Is there anything else that I have to do to be able to push the code to the emulator? 



Most of the emulator connection problems we have seen are a result of not having the most current version of the App Inventor setup software, or that software having been incompletely installed. 

Still, there can be many other issues that could cause the connection to the emulator to fail.  Please read and follow the document below on connection issues:

Click here for Emulator Setup and Trouble Shooting Instructions

If you still cannot get the emulator running after following that document, please post in the forum and we'll try to help you out.



Thank you for the post. Currently I have my emulator running but there is a continuous loop between the emulator starting the companion and verifying the companion. I have ports 8004 and 8001 open and have confirmed (using TCP Viewer) that ai2 is being used in 8004. However, I cannot access the link http://127.0.0.1:8001/ . I assume that this is a firewall issue on my schools end. However, when looking into the sites that my schools firewall is blocking, I have allowed access to all of the sites that are getting caught up and I am still having trouble with the companion starting and verifying. 

Is there anything else that could be stopping the companion from booting fully to the emulator? 



Just out of curiosity... do you have BlueStacks installed or running?  That has cropped up a few times as a problem.



Here is a list of a lot of things that can stop an emulator from displayingTony.     Have you gotten AI2 to work from your home network with an emulator?    If the project you have loaded ...you do have to have a project loaded to test the emulator...works there, it should work on the school network.

Here is the list...

One of the following  possibly applies to your code (all may not apply to your code):

1)  You have coding errors in your blocks.  In the Blocks editor, look in the lower 
left corner of the window for the yellow and red triangle icons. If the red icon has a value larger than 0, 
you have a serious coding error.  Find the block in your code that has a red triangle and 
fix it.   Red triangles always inhibit creating an apk or running a project in the 
emulator or possibly creating an aia file.     Yellow triangles are more forgiving, 
however, sometimes, these need to be fixed because they trip an internal warning and not billing puzzle piece sockets are left un-filled.

2) Your source file (the aia file) is larger than the 5Mb limit allowed in AI2 (the aia can not be larger than 5Mb). You may have put images or other resources in your Media (resources) that you do not use in the app. 
 All the images and sounds in resources count toward the 5Mb limit along with the souce code.    You can program 
apps larger than 5Mb in the browser, but the apps will not compile and might not run in the 
emulator or the project may not save as an aia. If this is the case you need to reduce 
the size of your image and/or sound files.   Most image files can be made quite small 
by resizing them using a photo manipulation program on your PC to less than 50Kb each.

3)  You might have more than 10 Screens in your app.  AI2 becomes unstable when more 
than ten screens are used.  Projects CAN be built with slightly more screen but then you should expect your app to occassionally behave erratically.

4) You might have set a Screen icon in the Designer Properties for your project that is too large. Use an image 
sizeof 48x48 px or 96x96px instead and only use jpg or png images.  *.ico files are not 
supported.  The 'icon' (actually an image) can be as large as 520x520 (I think that is the size GooglePlay apps require).  The smaller 'icons' work fine otherwise.

5) You did not code the entire project using App Inventor 2.   If you used one of the 
third-party AI2 clones,you might not be able to load a Project into the AI2 compiler or 
create an apk with the standard AI2.

6) If you incorrectly modified the project's Manifest files using a third-party tool, you may have issues.

7)  Sometimes, if you have LOTS of Layouts on a single screen,  the apk might not 
compile. How many is a lot?  I do not know, keep adding layouts and buttons, compile and try again...when the server crashes, you got a lot.

8)  The network you are using may be overloaded (possibly a school network), or you have other applications running in the background on your computer, or your virus checker is doing a scan.  Sometimes, just trying to access the MIT server a few minutes later will give you a more favorable response.

9)  If you have BlueStacks on your home PC (BlueStacks is a special emulator that allows Android apps to run on a PC).  The Google emulator on AI2 cannot run unless BlueStacks is disabled and all of the BlueStacks processes are shut down.  On a Windows PC, you use the Task Manager to 'kill' running processes.

10)  Are you using Sensor controls (except for the clock)?   Most Sensor controls or controls related to sms or the phone do not work in the emulators.  They need to be tested on a device.

11) If this is an issue about the Project loading slowly on your device or on the emulator:  Be aware, the more images, layouts, components you have on a screen, the longer it takes for the emulator and Companion to render the graphical screen.  How fast the emulator renders is partially a function of your hardware...how much ram you have, your cpu clock speed etc. Sometimes, with lots of graphics, the emulator will just give up.   Can you develop live using WIFI or using USB? These options almost always render faster than the emulator but will not be at lightning speed if you have lots of graphics.  Be patient.

12)  This happens too:   We have see instances where it is probable the Google Cloud messed up; other instances where an older PC has had memory issues and caused file corruption of the Project and instances where a user is using a very slow Internet connection (like dial-up) and it is just too slow.

13)  Do you have an AVG, Eset or AVAST virus checker.  Some versions of these products have been reported inhibit running the emulator unless (in the case of AVG) the Advanced Link settings on the software are set to allow AI2 communication.

The problem could be something else, like running an old version of Companion ...in this instance the cure might be:   Projects > Hard Reset.  If there are Companion issues a pop up will appear (if no issues, nothing will happen...just smile).  When the pop up appears, follow the instructions very carefully, then reboot your PC and try again.



Thanks for the list. There is nothing wrong with the code, and the code is not too big. I had the students simply put one button on one screen and one "On.Click Change Background Color" Command. At this point I have my students running App Inventor 1 and the emulator is running and working. It is a shame that I have to revert to the older version for this to work. 



Hi. I'm the guy who wrote the code that is used both in the Companion via WiFi and in the emulator. With the emulator "up" you should be able to go to: http://127.0.0.1:8001/ on the PC running the emulator. This should show you a small (possibly empty) directly listing (it will be a list of the assets that have been used in the emulator).

If the connection times out, that is a problem! The aiStarter program uses the "adb" program (in the "commands-for-AppInventor" folder) to setup "tcp port forwarding" from the PC to the emulator on port 8001. I suspect this command is failing for you. Make sure you don't have security software that is blocking the action of the "adb" command.


댓글 없음:

댓글 쓰기