2017년 8월 2일 수요일

App Inventor 2 will not connect with Emulator


Literally, yesterday, Sunday May 11, I downloaded and installed the App Inventor Emulator on 16 computers in my lab.  I have not been able to get AI2 connect with the emulator from either Firefox or Chrome.

Initially, the emulator starts, and eventually opens AI@ Companion v. 2.11ai2, which then announces that it has stopped working and gives the option to either Force Close or Wait.  At the same time, AI2 announces that an update needs to be installed.  I click OK to install the update.  From the emulator phone I get a message that there has been a "parse error in the package." and nothing further happens.  I have tried turning off ESET, the security software.  I tried a Hard Reset on the phone. No joy.

It took me most of an hour to install the emulator on the computers, but if there was an updated version, one that did not require an update as soon as it was installed, then I would be willing to spend the hour over again.

I also installed the emulator on my own laptop, also running XP.  I use AVAST for security and avast had me approve the following internal TCP/IP traffic, after which I was able to connect to the emulator, update it, and connect to it with the app. 

Local Port
Remote Port
Localhost:8004
Localhost:0
Localhost:2721
Localhost:5037
Localhost:5555
Localhost:0
I had our technician who manages ESET try to get the emulator to work and he was able to do it with ESET installed and running.
Windows Firewall is turned off by Group Policy.

Any suggestions???

--
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.   At the present, the most recent version of Companion is 2.17.  Not having the most recent version of Companion might be part of your issue.


Have you read and tried the suggestions in the above link?

--
Jim, when you send emails instead of responding in the forum you delay a response.  There are several here in the forum that can help you but the response must be in the forum for others to see the issue.

I tried everything in the document.  I got it to work once.  I'm not really sure how.  I think at the first "Force Close" dialog, I clicked "Wait" and then when the dialog came up in AI2 to upgrade Companion in the emulator, I selected "Not Now" or whatever the button was.  Eventually, the emulator connected with AI2.
Trying to upgrade the Companion in the emulator otherwise just resulted in the Parse Error and the connection failed.  After that, for some reason, it required a restart of the computer.  Sometimes that actually meant a "hard restart" using the button on the computer box.  Not sure what happens there.  Might be a memory issue not trapped by XP.

One of the technical staff will review your responses, so check back here frequently.  They are very busy but do want to help.  Thanks for the images.

My suggestion is that you do a complete uninstall of app inventor 2.  Then, try once again, documenting everything that happens.  Capture screen images where you get error messages etc.  All this will help the technical staff to diagnose your issue.

This is an annotated part of the install process:
PART 1:  App Inventor Setup Tools installed, updated and aiStarter is running.

Step 1: Make sure you are logged into an Administrator account     Yes, the students cannot be administrator's but the PCs need this for the install.   Install, then change Administrator privileges.

Step 2: Go To the App Inventor 2 Test page by clicking the following link.

http://appinventor.mit.edu/test

This page will perform some tests and indicate whether you have the aiStarter program running and if you have the current version of the setup tools installed.  From the AI2 browser menu, select Help>About to find the current version of AI2 and the date of its most recent modification. The About box also tells you which version of AICompanion you should be using with this version of AI2. Check and you know you have the correct AI2-Companion combination

Did this step work?

Step 3: If aiStarter is running proceed to step 4.  You will know aiStarter is running if a Windows screen called aiStarter appears on your desktop. There are lots of numbers on a black field.

If aiStarter is not running, then start aiStarter by locating the aiStarter icon on the desktop.   When aiStarter was installed, the installer provided a desktop icon. There should also be a link in the start menu, or in the AppInventor directory located in the “Program Files” or “Program Files (x86)” directory.  Now try the test page again. If the aiStarter is running then proceed to Step 4.

If aiStarter is still not running then you need to install the setup tools by following the instructions at the link below and try the test page again.

http://appinventor.mit.edu/explore/ai2/windows

Don’t neglect the part of the instructions dealing with logging out (or rebooting) and running the uninstaller.   Again, you must reboot your PC before runing the uninstaller from the Program Files directory, and then attempting to install/re-install aiStarter.     THIS is VERY important... yes, you need to log out / rebooting.

Step 4: If aiStarter is running but your setup tools are not up to date

If aiStarter is running but your setup tools are not up to date as indicated on the test page, reinstall the setup tools by following the instructructions below and come back and try the test page again.

http://appinventor.mit.edu/explore/ai2/update-setup-software

Repeat these steps until aiStarter is running and you have the updated setup tools.

Note:  When the setup tools are installed aiStarter will automatically start when you log in to your Google account the next time.

Problems:  If you cannot successfully complete Part 1, the reasons  might be
Your computer cannot connect to the software download site for the App Inventor setup software.
There is a program running on the computer that is using port 8004, which is the port that aiStarter needs in order to run, or your internet service provider has blocked those ports.

For either of these issues, you will need to work with your network provider or your IT service to resolve them.
PART 2: Getting the emulator running on the computer
Once you are sure that aiStarter is running and your setup software is current, you can try starting the emulator.  With App Inventor running in your browser, choose the “Emulator” option from the “Connect” menu, and the emulator should start.  How fast your emulator starts is a function of your PC's cpu and the amount of memory available to the PC. On a Win 7 PC with lots of memory, the emulater may take only a few seconds to start; on slower PCs, the process might take a several minutes.The might take a few minutes.

The Emulator is a virtual phone. Starting the emulator will both start this virtual phone and will then run the MIT AI2 Companion in this virtual phone. There are several places in the process of starting the emulator where things can go wrong. Here are some hints to help figure out what the problem might be be.

When the virtual phone starts, you should get to a “home” screen that looks like this:
emulator2.png
If you don’t see this “home page” then there is something wrong with how your computer is starting the emulator. At this point you will likely need to find someone who has access to an Administrator’s account on the computer you are using.
Be aware, you do NOT have the current version of Companion...it is imperitive that you have version 1.17 of Companion... can you confirm that you have Companion 1.17?
They should log in and try to use App Inventor to start the emulator. If they can use the emulator with their administrator, but the ordinary user account on your computer your account cannot, then there is probably some restriction in place on your computer that is preventing App Inventor’s emulator from operating properly. You will have to experiment with removing restrictive settings and or disabling programs that enforce restrictions to see which one is causing the problem. Once this is determined you (or your administrator) should leave this program disabled or figure out how to configure it so that it does not interfere with App Inventor.  We cannot tell you here exactly what you need to do because there are a lot of programs that are used to restrict and protect Windows accounts, and what you need to do will be determined by which program you are using.  Some issues people have encountered include restrictions on access to the Web, prohibitions against running .exe or .bat files, and inability to access the commands-for-appinventor directory.  One way to look for hints as to what might be wrong is to open a command window in the commands-for-appinventor folder, where the setup software was installed.  Then try to launch the emulator manually using the command run-emulator.bat and see if there are any error messages.
Another possibility (on older computers) is that the computer is not powerful enough to run the emulator.  Symptoms might be that the emulator starts, but never gets past a black screen.
PART 3: Getting the emulator to connect to App Inventor
Do you see the above screen?  
If you see the virtual phone’s home screen (above) but cannot get any further, then there may be a problem with how the virtual phone is set up. You can reset the emulator by selecting the Hard Reset choice in the Connect menu. This will reset the virtual phone to the “factory” state it was in when the setup tools were first installed. Note: When you select Connect->Hard Reset you will see a dialog box warning you that it will reset the emulator.   If the factory version of the MIT AI2 Companion is out of date, the system will lead you through the process for auto-updating the Companion, once the emulator is running.
If you cannot get things working at this point. You can try uninstalling and re-installing the setup tools.   Did you do this uninstall?

If this still doesn’t work, then you will need to find a system administrator (who can login to an Admin account on your computer) and try the steps listed in Part 2 regarding programs that might be interfering with App Inventor. Again, there are many such programs and we cannot tell you how to change their settings.  You will likely need some expert help.
PART 4: Getting the emulator to update      THIS could be your issue.   Did you try this?
The emulator connects to App Inventor using an app (the AI2 Companion) that runs in the emulator.   If this app is out of date, App Inventor will offer to update it.   If the update fails, you can bypass the update temporarily, but you should update soon, since newer App Inventor features might not run on the emulator, and new apps might crash.
                        companion app out of date.PNG
Some problems you might encounter
If you get the message that your Companion is out of date, and App Inventor does not offer to update it, then you probably have a very old Companion that predates the auto update feature.   Please update your setup software.
PART 5: Talking to the Emulator

Some people have reported getting the Emulator running and even the Companion, but then their blocks do not load. Instead you continue to see the “white screen” of the Companion claiming that it is waiting to get blocks.
The Companion listens on port 8001. If something is blocking that port, then it will not be able to receive any blocks. Similarly if another program is using port 8001 the same thing can happen.
To test if this is the problem, while in this state, use your browser to go to http://127.0.0.1:8001/
If you get a directory listing (it will start with “Directory /”) then you are talking to the Companion. Note: There may only be the line “Directory /” or you may *also* see a listing of files which you should recognize as project assets (images, sounds etc.). What you see isn’t important, it is the fact that you can see it.
If you cannot connect to http://127.0.0.1:8001/ then you will have to look at what other programs on your PC may be interfering with connecting to the Companion. This can be anything from a firewall, to another program using the same port.
The guy(s) who will help you will need to know the answers to the above questions.    Yeah, I know you mentioned some of this, however, in places you seem unsure of what actually happened.  We would appreciate you confirming the individual steps.
We will work with you to get you running.

Still using XP..recommend you have a GOOD virus checker as MIcrosoft stopped supporting Xp...probably not your issue.

--
I tried everything in the document.  I got it to work once.  I'm not really sure how.  I think at the first "Force Close" dialog, I clicked "Wait" and then when the dialog came up in AI2 to upgrade Companion in the emulator, I selected "Not Now" or whatever the button was.  Eventually, the emulator connected with AI2.
Trying to upgrade the Companion in the emulator otherwise just resulted in the Parse Error and the connection failed.  After that, for some reason, it required a restart of the computer.  Sometimes that actually meant a "hard restart" using the button on the computer box.  Not sure what happens there.  Might be a memory issue not trapped by XP.
Additional information this AM.  In 1st Period, 12 out of 13 computers experienced a Windows Error that closed Emulator.exe.  The third opened the emulator.  After clicking on "Wait" and "Not Now" the emulator did connect.  It downloaded the buttons for the XmasTree app from teh Cengage AppInventor book, but not the tree images or programming.  
As an experiment, I increased the Page file Size on my screen laptop to maximum.  It actually loaded the emulator and connected after the "Wait"/"Not Now" sequence, but stopped at the same place as my student's computer.  The laptop only has 1MB installed memory.  The lab computers have 2MB.  I will try to up the page file size for the lab computers in the next day or so and see if that makes any difference.  
Would it help to copy and post the details out of the Microsoft Error Report for emulator.exe?
--
I tried everything in the document.  I got it to work once.  I'm not really sure how.  I think at the first "Force Close" dialog, I clicked "Wait" and then when the dialog came up in AI2 to upgrade Companion in the emulator, I selected "Not Now" or whatever the button was.  Eventually, the emulator connected with AI2.    You have to upgrade Companion ... selecting "Not Now" means there was no upgrade and eventually the emulator connected, but then you did not have the UPGRADED companion.  Does the emulator window indicate Companion version 2.17....    if not, you are going to have to get the latest version of Companion running.
Trying to upgrade the Companion in the emulator otherwise just resulted in the Parse Error and the connection failed.  After that, for some reason, it required a restart of the computer.  Sometimes that actually meant a "hard restart" using the button on the computer box.  Not sure what happens there.  Might be a memory issue not trapped by XP.    The hard restart checks to see if you have an upgraded companion and if not, it attempts to upgrade.
Additional information this AM.  In 1st Period, 12 out of 13 computers experienced a Windows Error that closed Emulator.exe.  The third opened the emulator.  After clicking on "Wait" and "Not Now" the emulator did connect.  It downloaded the buttons for the XmasTree app from teh Cengage AppInventor book, but not the tree images or programming.  There might be an issue with the XmasTree app itself; try a different, simple project.  Be aware that projects with resources exceeding 5MB will crash the emulator; projects with coding errors will crash the emulator.  The small amount of installed memory on both the laptop and lab computers MAY be further limiting what type of Projects your students can successfully build and run on the emulator...they may have to run and test the projects on an actual device using WIFI or USB.    I am not sure this the small amount of RAM but using Firefox or Chrome use a lot of resources.  Make sure the student's PCs are not running additional software other than the virus checker etc. and also that they limit the number of windows open on the browser.... all these will help the pc to work with its limited memory.
What may be happening is the emulator is taking a very long time to load.... students should be clicking on Wait .... and that may be a minute or two.... that bit of info seems to show your issues are PC resource limited.
As an experiment, I increased the Page file Size on my screen laptop to maximum.  It actually loaded the emulator and connected after the "Wait"/"Not Now" sequence, but stopped at the same place as my student's computer.  The laptop only has 1MB installed memory.  The lab computers have 2MB.  I will try to up the page file size for the lab computers in the next day or so and see if that makes any difference.  
Would it help to copy and post the details out of the Microsoft Error Report for emulator.exe?   YES, but at the moment, my opinion is that you may have several issues.... low memory on the PCs and possibly a slow Internet connection on the networked PCs and the PCs all compete for the limited bandwidth.     This is my opinion...I do not really know.
Be sure to visit here frequently in next few days.
--
OK, by the numbers...


1. AppInventor tools are installed and open.  I get the green "AI Starter is running"  (BTW, I can see the AIStarter cmd screen on my computer as I am writing this, but the test says it is not running on this computer)
2. The emulator is running.
3. The emulator is communicating with AI2
4. Attempting to update AI2 Companion on the emulator results in a Parse Error on the emulator.
5. Typing 127.0.0.1:8001/ does get a directory.
My school district uses ESET.  One of the District techs was able to get the emulator to work on a Windows XP box with ESET running.  I am not sure whether it has more memory running or what the difference was.
--
I tried everything in the document.  I got it to work once.  I'm not really sure how.  I think at the first "Force Close" dialog, I clicked "Wait" and then when the dialog came up in AI2 to upgrade Companion in the emulator, I selected "Not Now" or whatever the button was.  Eventually, the emulator connected with AI2.    You have to upgrade Companion ... selecting "Not Now" means there was no upgrade and eventually the emulator connected, but then you did not have the UPGRADED companion.  Does the emulator window indicate Companion version 2.17....    if not, you are going to have to get the latest version of Companion running.  Attempts to upgrade Companion result in a Parse Error.  See Screen shot from previous reply.  After the Parse Error is displayed, AI2 will no longer connect with AIStarter.  
Trying to upgrade the Companion in the emulator otherwise just resulted in the Parse Error and the connection failed.  After that, for some reason, it required a restart of the computer.  Sometimes that actually meant a "hard restart" using the button on the computer box.  Not sure what happens there.  Might be a memory issue not trapped by XP.    The hard restart checks to see if you have an upgraded companion and if not, it attempts to upgrade.  Is this the Connect|Hard Restart command in AI2 or something in the emulator itself.  If it's in the emulator, how do I use the emulator menu screens to find it?
Additional information this AM.  In 1st Period, 12 out of 13 computers experienced a Windows Error that closed Emulator.exe.  The third opened the emulator.  After clicking on "Wait" and "Not Now" the emulator did connect.  It downloaded the buttons for the XmasTree app from teh Cengage AppInventor book, but not the tree images or programming.  There might be an issue with the XmasTree app itself; try a different, simple project.  Be aware that projects with resources exceeding 5MB will crash the emulator; projects with coding errors will crash the emulator.  The small amount of installed memory on both the laptop and lab computers MAY be further limiting what type of Projects your students can successfully build and run on the emulator...they may have to run and test the projects on an actual device using WIFI or USB.    I am not sure this the small amount of RAM but using Firefox or Chrome use a lot of resources.  Make sure the student's PCs are not running additional software other than the virus checker etc. and also that they limit the number of windows open on the browser.... all these will help the pc to work with its limited memory.  XmasTree is about as simple as it gets.  Two buttons, each with an event handler that has 4 "set..." commands, and two images of 240 KB each. Connect|AI Companion works perfectly with my Android.  Unfortunately, there is only one or two student Androids in each class.  I really need to get the emulator working.
What may be happening is the emulator is taking a very long time to load.... students should be clicking on Wait .... and that may be a minute or two.... that bit of info seems to show your issues are PC resource limited.
As an experiment, I increased the Page file Size on my screen laptop to maximum.  It actually loaded the emulator and connected after the "Wait"/"Not Now" sequence, but stopped at the same place as my student's computer.  The laptop only has 1MB installed memory.  The lab computers have 2MB.  I will try to up the page file size for the lab computers in the next day or so and see if that makes any difference.  
Would it help to copy and post the details out of the Microsoft Error Report for emulator.exe?   YES, but at the moment, my opinion is that you may have several issues.... low memory on the PCs and possibly a slow Internet connection on the networked PCs and the PCs all compete for the limited bandwidth.     This is my opinion...I do not really know.  The memory issue may be a problem.  Is the emulator communicating through the AI2 server system, or directly with the AI2 web application on the client machine?  If so, bandwidth should not be a problem.  Our bandwidth is limited as the use of technology has increased exponentially.
Be sure to visit here frequently in next few days. I have the gmail account configured to my Outlook, so I will get immediate notice of any replies.  Thank you.
--
From what I can tell, it just looks like the computers are slow and/or do not have enough memory. The emulator requires significant resources, it is literally emulating a phone on the computer, which uses a lot of resources.

--
I upped the virtual memory page file size to initial of 6GB and max of 12GB.  We'll see if that makes a difference.

You still didn't answer the question: is the emulator working through the computer's internet connection back to the AppInventor server, or is it making an internal TCP connection to the AI2 web application in the browser?

The reason I ask is that if the emulator is working through the computer's internet connection, it would seem simpler to have the user start the emulator, open AI2 Companion on the emulator and simply enter the code for the AI Companion connection in the AI2 Web app.  That way, if AI2 Companion needs updating, the user could update the emulator just like updating a phone.

Also, to ask the question again, is the "Hard Reset" you referred to part of the AI2 Web App's Connect menu or something else?

--
You still didn't answer the question: is the emulator working through the computer's internet connection back to the AppInventor server, or is it making an internal TCP connection to the AI2 web application in the browser?   The emulator is running on the local PC..AI2 'thinks' the emulator is a phone.

Also, to ask the question again, is the "Hard Reset" you referred to part of the AI2 Web App's Connect menu or something else?    Hard Reset is on the AI2 Connect menu.

You did not say so, but it appears you still are running

@Jeff  ... note, Jim is also having issues installing the latest version of Companion..    Look at his comments regarding Parse Error.  Is that a memory issue too?

--
The hard reset does not update the emulator.  It takes it back to AI2 Companion v. 2.11 ai2.  With the larger memory, 1 student got the emulator to actually fully work.  2 others were able to get it to update AI2 Companion.  The version on the emulator after update is 2.17 ai2. However, it did not connect to AI2 Web App.  Do you need to close and re-open the emulator after the update?

Another student got the Windows Error message: here is the image of the details:

I understand that the emulator is running on the local PC.  Does it connect with the AI2 Web app through an internal TCP connection on the local machine, or does it use Winsock to connect to the AppInventor server, which then connects to the A!2 Web App?  In other words, is the connection between the emulator and the AI2 web app dependent on network bandwidth or not?


--
The hard reset does not update the emulator.  It takes it back to AI2 Companion v. 2.11 ai2.  With the larger memory, 1 student got the emulator to actually fully work.  2 others were able to get it to update AI2 Companion.  The version on the emulator after update is 2.17 ai2. However, it did not connect to AI2 Web App.  Do you need to close and re-open the emulator after the update?

With the larger memory, 1 student got the emulator to actually fully work.-- was the student using Companion 2.11 or 2.17?      The others got AI2 Companion updated.  I assume all the PCs are identical or nearly so.  If that is the case, it should be possible to get companion updated on all the PCs.  I assume this happened during a class when all the PCs are on the network, competing for bandwidth.  This implies, if you do the memory cache, that you should be able to get all the PCs updated.... however, this may have to be done when the network is not in heavy use or with only one PC network connected at a time.   Something to try.

The hard reset MIGHT update the emulator when the network is at low usage.   How did the two students get Companion to update?
Another student got the Windows Error message: here is the image of the details:   OK, however, the details are not in that message, if you look at that screen, to get the Details, one would have to have clicked  on the that says "To view technical info."  click here" .   Thanks for trying to capture.



I understand that the emulator is running on the local PC.  Does it connect with the AI2 Web app through an internal TCP connection on the local machine, or does it use Winsock to connect to the AppInventor server, which then connects to the A!2 Web App?  In other words, is the connection between the emulator and the AI2 web app dependent on network bandwidth or not?

I do not know the answer to that...perhaps Jeff will comment?  I expect the connection is dependent on the network bandwidth but I do not know.  Try running a single PC after classes...if the PC works significantly better, then you have answered the question yourself.

You mentioned the size of the Xmas tree images.two images of 240 KB each   ...hmmm that is 480 Kb = 0.5 Mb and the PCs have 2 MB memory?     As was mentioned, unfortunately ya'll are under-resourced.  To get that app to work, I would suggest going into Paint and  attempting to reduce the resolution of the images to something like 50KB each or so and replace the existing images..that should help getting that particular project to work.

Another suggestion....rather than use 12 PCs,  use six and let the students work in pairs.  If part of the issue is network bandwidth, working this way should ameliorate.  Keep in mind, if other activites other than your class are using network bandwidth...such as secretaries, teachers etc. using the Internet or other classes; this simple suggestion will not work.

You do realize Xp with 2Mb memory and caching is going to be slow.  The browser's alone use a significant amount of memory.

--
Sad as it is, I had to tell the students we were going to bag the AppInventor unit and go on to something else.  Public Education in California...  Maybe with some money flowing next year, we can get upgraded hardware and software.

I appreciate all your help.  The AI2 interface works wonderfully, but without an emulator to test on, and with only myself and one or two students having android phones, it is not workable.

--
Sorry app inventor is not going to be practical at your school until you get a technology upgrade.  

Good luck with whatever you replace it with.   Not knowing the grade, something to consider might be the free Object Pascal compiler called Lazarus.  Check out the website Delphi for Fun and search for Lazarus...however I fear that will be too advanced.    Object Pascal is not a difficult programming  language ...certainly easier than Visual Basic however it is for Windows, though they might have an Android module by now...

--
If you want to give the students a taste of App Inventor, you may consider using the AI1 classic  for the time being.  

--
I haven't looked at AI Classic.  Does it have an emulator that uses less resources?

--
You can also look into emulators from Genymotion... They require some setup, and are free...

www.genymotion.com

--
I am teaching an online App Inventor course for teachers. In the past, although there have been some emulator glitches, I have gotten everyone up and running.   I have two teachers in this class  who are on apples and getting parse errors from  the emulator (and are very frustrated - sigh) - I read through the thread, but was not clear what the cause and  solution to the parse error message was.
Any help would be appreciated.

--

댓글 5개:

  1. eToro is the most recommended forex broker for rookie and full-time traders.

    답글삭제
  2. Looking for the Ultimate Dating Website? Create an account to find your perfect match.

    답글삭제
  3. QUANTUM BINARY SIGNALS

    Get professional trading signals sent to your mobile phone daily.

    Start following our trades right now and gain up to 270% per day.

    답글삭제
  4. BlueHost is ultimately one of the best hosting company for any hosting plans you need.

    답글삭제
  5. If you need your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (even if they're dating somebody else now) you need to watch this video
    right away...

    (VIDEO) Why your ex will NEVER come back...

    답글삭제