2017년 1월 25일 수요일

Installing App Inventor 2 Setup on Windows


Installing the Windows software for App Inventor Setup has two parts:

1. Installing the App Inventor Setup software package. This step is the same for all Android devices, and the same for Windows XP, Vista, Windows 7, 8.1, and 10.

2. If you choose to use the USB cable to connect to a device, then you'll need to install Windows drivers for your Android phone.
NOTE: App Inventor 2 does not work with Internet Explorer. For Windows users, we recommend using either Chrome or Firefox as your browser for use with App Inventor.

Installing the App Inventor Setup software package

You must perform the installation from an account that has administrator privileges. Installing via a non-administrator account is currently not supported.
If you have installed a previous version of the App Inventor 2 setup tools, you will need to uninstall them before installing the latest version.
Follow the instructions at How to Update the App Inventor Setup Software.

1. Download the installer.

2. Locate the file MIT_Appinventor_Tools_2.3.0 (~80 MB) in your Downloads file or your Desktop. The location of the download on your computer depends on how your browser is configured.

3. Open the file.

4. Click through the steps of the installer. Do not change the installation location but record the installation directory, because you might need it to check drivers later. The directory will differ depending on your version of Windows and whether or not you are logged in as an administrator.

5. You may be asked if you want to allow a program from an unknown publisher to make changes to this computer. Click yes

Locating the Setup software

In most cases, App Inventor should be able to locate the Setup software on its own. But if it asks for the location of the software, the path to enter is C:\Program Files\Appinventor\commands-for-Appinventor. If you are using a 64-bit machine ((How to tell if you're on 64-bit Windows), you should type Program Files (x86) rather than Program Files. Also, if you did not install the software as an administrator, it was installed in your local directory rather than in C:\Program Files. You'll need to search for it to find the correct pathname.
Something not working right? Visit the troubleshooting page, or check the App Inventor User Forum for help.

Continue with setup - Choose the connection instructions you were following:

Operating System Compatibility


I am using OS  Windows 8.1. I don't have Android phone. So, I will have to try out emulator. I was going through this for installation steps :
http://ai2inventor.blogspot.kr/2017/01/installing-app-inventor-2-setup-on.html
In the beginning 1st point shows ,"This step is the same for all Android devices, and the same for Windows XP, Vista, and 7."I would like to know can I install on Windows 8.1?

--
Just try it. It should probably work, but Windows 8.1 is a strange duck. If you can, plan to upgrade to Windows 10, that is much better.

-- 
I use 8.1 with no problems.

-- 
Fixed.  Thanks for noticing this.

-- 


List of Variables


Is there anyway of having a list of variables as opposed to just text and numbers? it would help my program to have these as the list i want to make will be ever changing during the progress of the app being played, also where the list is being used I want to have a coloured background label with the width dependent on a variable I want in the list so as the app is cycling through the list the width of the label is adjusted to the variable being displayed in the list. 

--
You can define a list of label components in Screen1.Initialize, and reference them using the Any Label blocks later.

Is that what you want?

-- 
no i want to attach a variable block to a make a list block but it doesnt allow it, it only allows a empty text block or empty math block for you to edit. i guess lists can only be made of text and numbers like in the tutorials.

-- 

 i guess lists can only be made of text and numbers like in the tutorials.

that's correct
to replace list items, just use the replace list item block, there is no need to use variables in this case
-- 
 i guess lists can only be made of text and numbers like in the tutorials.
btw. you also can add lists as list items, see also

-- 

update query fusion tables


i want to make a block query to update a column in google fusion tables , what is the template query ? 

--
this query doesn't work

question update.JPG 표시 중

-- 
For UPDATE statements the first step to be done is to get the ROWID of the row to be updated with a SELECT statement. The second step is to do the UPDATE.


-- 

Debugging issues in running the App Inventor Setup Tools and the emulator on Windows


Debugging issues in running the App Inventor Setup Tools and the emulator on Windows
(or what to do when things don’t work right!)
You are welcome to add comments to this document. To do so, open it in Google Docs.
MIT App Inventor’s setup tools will install and work on most computers.  But there can also be occasional difficulties.  Several things can cause App Inventor to fail. These include: (1)insufficient memory on the computer, 2) Use of programs that restrict access to the Internet (Firewalls, anti-virus software etc) or prohibit the computer from performing read/write operations to the PCs hard drive.
For school setups especially, the App Inventor team does not know all the kinds of limitations that schools impose on classroom computers, that cause problems for App Inventor. We are updating our tools to deal with specific limitations as we discover them.  Please help us by adding comments to this document at places where the procedures listed below do not work.  Please also report the limitation as issues in the App Inventor support forum.   We may contact you to learn more about your particular computer and networking configuration.
This document provides help in dealing with problems that people typically encounter getting App Inventor to run on Windows computers.   A separate document dealing with Macintosh computers is being prepared.   Some issue can be easily dealt with by reinstalling the setup tools.   Other issues may may debugging and investigation, and you may need to get help from someone familiar with the use of the Windows command line.
The instructions below cover four stages getting the setup tools working, and then connecting to the emulator:
⦁ Installing the setup tools and getting aiStarter to run.  aiStarter is the software that allows AI2 to communicate with your PC.
⦁ Starting the emulator. The emulator is a piece of software that simulates the use of a phone or tablet on your PC.
⦁ Getting the emulator to connect to App Inventor
⦁ Getting the emulator to update to the latest available version, if necessary
PART 1:  App Inventor Setup Tools installed, updated and aiStarter is running.

⦁ Step 1: Make sure you are logged into an Administrator account
⦁ Step 2: Go To the App Inventor 2 Test page by clicking the following link.

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
  • 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.
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.
  • 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.
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 emulator 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.
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
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. 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
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.

MIT App Inventor 2 Connection Test


Is aiStarter running?
NO, aiStarter is not running!

Please make sure the aiStarter application is running. Get aiStarter Help
Is your phone connected via USB?
Not yet, standby...






General Connection Help


If you are having trouble connecting your device or emulator to App Inventor, you've come to the right place! Below are links to all of the information we currently have to help you get connected.

Help with aiStarter

Connecting to the emulator (Windows or Mac)

Connecting to a phone or tablet over USB on Windows

Connecting to a phone or tablet over USB on a Mac

Also see:

<<Back to Main Setup Page

Help with USB connection on Windows


This page contains help for when you have connected your Android device to a Windows PC with the USB cable, and the Connection Test says that the device is not detected.
In order to connect your device to a Windows PC over the USB cable, you need to install a driver on your PC. The driver is a software module that lets the PC interface to the device hardware. Unfortunately, different devices require different drivers, and Google and Microsoft have generally left it to the device manufacturers to develop and distribute the drivers. The App Inventor setup software comes with drivers for a very small number of Android devices. You might be lucky enough that these work for your device -- but probably not. In that case, you'll have to get the driver from the manufacturer, and install it on your PC yourself.
Here is Google's link to OEM (Original Equipment Manufacturer) Drivers. It shows where to get drivers for the devices that Google knows about, and explains how to install them on PCs.
Google also distributes drivers for the Nexus devices that it manufactures. If you have a Nexus device. Look here for the Google USB Driver. To get the driver from there, you can use the link that says Click here to download the latest Google USB Driver ZIP file. You do not have to download the entire Android SDK.
When you are done installing the driver, go back and review the steps in Connecting to a phone or tablet with a USB cable. Hopefully, the connection test will succeed this time. If it does not, the most likely place for an error is in installing the drivers, especially if you have never done this before. So try again and/or get help.
If you are still having trouble, see Google's page on Using Hardware Devices. Other than that, try searching on the web for issues about using your particular device with USB.

<<Back to Setup Device on USB

<<Back to Main Setup Page

Help with USB connection on Mac


This page contains help for when you have connected your Android device to a Mac with the USB cable, and the Connection Test says that the device is not detected.
You should not be here: according to Google's instructions in Setting up a device for development, "it just works." Of course, nothing "just works."
Try reviewing the connection steps at Connecting to a phone or tablet with a USB cable . If you can't find anything wrong, post an issue to the forum. But a problem at this level is unlikely to involve App Inventor per se. It's more likely a connection problem with the phone, perhaps even something as mundane as a bad USB cable.

<<Back to Setup Device on USB

<<Back to Main Setup Page

Help with problems connecting the emulator


App Inventor provides an Android emulator for people who do not have Android devices, or who would prefer not to use one while creating apps. To use the emulator, choose Emulator from the Connect dropdown menu. The emulator should start on your computer, and connect to App Inventor so you can test your app and do live development.
The process that starts the emulator involves several programs working together. There are many things that can go wrong, such as unexpected configurations, restrictions on the network you are using, or other software running on your computer that interferes with App Inventor. For school computers, we've seen several issues that interfere with App Inventor, including firewalls on school networks, restrictions on software the the machines can run, and ports being blocked. Symptoms you might encounter include the emulator starting up and then freezing, or not starting at all, or App Inventor displaying "unable to connect" messages.
If you encounter a problem connecting to the emulator, visit the page
This gives a step-by-step procedure for attempting to isolate and ifix issues. (This procedure is for Windows. The issues are the same for MacOS and we will be publishing a Mac version of this document soon.)
Please go through this procedure before filing an issue on the App Inventor forum. If you eventually file an issue, first search on the forum to see if others have experienced similar problems. When you post to the forum, describe the results of the steps you tried, so that people who want to help you will have more information about where to begin.
Here are some other things to investigate as part of your debugging.

Things to check first

Does the problem of the emulator not starting occur with just this project or with all your projects?
If the problem is with only this project then there is probably something in the project that is tickling a bug in App Inventor. Please submit an issue and include the project source (aia) file. On the other hand, if the emulator won't start for any of your projects, then continue with the debugging steps here. An intermediate case is when you have a large project that has many images or sounds, or many screens. In that case, try reduced versions of the project that have fewer screens or assets to see how large things before the problem occurs.
Is there another device connected to your computer?
If there is a phone plugged in, then unplug it. The current App Inventor 2 software can handle only a single device and will get confused if more than one device is connected. Similarly, App Inventor will get confused if there is more than one emulator running. Kill any running emulators before trying to start another one.
Is the setup software installed in the correct directory?
The App Inventor directory the Commands for App Inventor software should be installed in Applications on the Mac; or C:\\Program Files or C:\\Program Files (x86) on Windows; or /usr/google on GNU/Linux. The setup software won't find the emulator support if it's in a different location.
Is your browser running an extension that blocks connections?
An example of an extension that blocks connections is the NoScript extension for Firefox. If you are running this or something similar, you'll need to turn it off, or configure it to not block the App Inventor connections.
Is App Inventor asking you to restart the companion?
Part of the App Inventor software includes the App Inventor Companion app, running on the emulator. If App Inventor has trouble communicating with the emulator, it may ask you to restart the Companion. To do this, use the emulator on the computer screen: press the (image of the) menu key, and then the button to kill the app. If the Companion tarts up again, asking about a QR code, press the menu key and kill it again. Now select emulator again from the App Inventor connect drop-down menu. Restarting the Companion might not solve your problem (there might be another underlying cause) but it is a good first step.
Are you waiting long enough?
When the emulator starts, it first appears as a black screen with the word Android in the middle. In some cases, it can stay that way for as much as several minutes while the emulator program starts up. We don't know why this is, and it might not happen all the time, but we'll keep investigating. Once the emulator gets past that, the screen will turn completely black and then come up with the Android home screen. Shortly after that, App Inventor should recognize that the emulator has started and start the companion in the emulator, and then load the blocks for your app. If things break at some point in this startup, you'll need to do some further diagnosis (see below) but the first thing is to wait.

Further diagnosis and debugging

If you've tried everything above, and there are still problems, you'll need to do some diagnosis and debugging. This will require using the console commands. Try to get help if you are not familiar with using the command console.
As an overview, running the emulator involves the following
components:
  • The Android emulator program running on your computer.
  • The App Inventor Companion app running in the emulator.
  • The aiStarter program running in your computer. It manages the connection between the browser and the emulator.
  • The adb (Android Debug Bridge) program running on your computer, which lets the computer control attached Android devices.
  • rendez-vous server running at MIT, which App Inventor and the Companion use to inform each other of their IP address.
You may have to check some or all of these in the following diagnostic steps.
Can the computer run the emulator program at all?
If the emulator does not start at all (i.e.,you don't see the emulator window appear on the computer screen). It might be that there is a permissions issue in accessing files or directories that keeps the emulator from starting. There are also cases where administrative software prevents school computers from running scripts (bat files). This will also prevent the emulator from working. To diagnose this, get out of App Inventor, go to the the Commands for App Inventor directory and run the command run-emulator. Examine the console output for the emulator program to see if that gives you a hint about why the emulator isn't starting. (Don't worry if you see a warning about adjusting the partition size -- that's normal.) After you've dealt with the problem, try run-emulator again. Then kill the emulator program and try App Inventor with starting the emulator as usual.
What is aiStarter starter and how do I start it?
The aiStarter program is installed on your computer when you install the App Inventor Setup software. It provides communication between App Inventor running in the browser, and other parts of App Inventor. Whenever you want to use the emulator or the USB cable, you need to make sure that aiStarter is running. If it is not running, you'll get an error message saying that aiStarter does not appear to be running. On Windows, there should be a button on your desktop that starts aiStarter. On the Mac, aiStarter should start automatically, so Mac users should not have to worry about this. In case aiStarter somehow does need to be started manually on the Mac, find it using Spotlight, use the Finder to go to /Applications/AppInventor/commands-for-App, and double click on aiStarter. On GNU/Linux, this program is in /usr/local/bin. You should be able to start it by typing aiStarter from a terminal.
How can I tell if aiStarter is running correctly?
aiStarter is running correctly if the emulator (or USB) connect. If you want to diagnose a problem with aiStarter, try running aiStarter from the console.
Then, when you try to connect the emulator, the console output for aiStarter should show a sequence of "probes" of the form
127.0.0.1 - - [01/Dec/2013 11:28:30} "GET /replstart/emulator-5554 HTTP/1.1" 2000
There might also be problems, like a message about blocked ports, or issues with the adb program. For a blocked port, check whether there is another program on the computer that is using the port.
Is adb running correctly?
The adb program can sometime get confused, especially if there are other issues. Open a console in the Commands to App Inventor directory, and run the program adbrestart and see if that helps.
Is the correct device on line?
If the emulator is started and has been in the process of starting up for a while (and is past the completely black screen), run the command adb devices in a console window. The result should show a list of devices:

emulator-5554 device
There should be exactly one device: the emulator. Disconnect any other devices. If the status of the emulator is offline rather than connected, then you might not have waited long enough, or there might be some other program using the emulator port 5554. You'll need to find that program and disable it. If the emulator doesn't continue starting up, kill it and try connecting again.
Is the emulator running, but App Inventor keeps counting down in a loop trying to connect to it?
This means that App Inventor cannot communicate with the AI Companion program running in the emulator. The first thing to try here is to reinstall the AI setup software as described here: How to update the App Inventor Software. If this doesn't work, then check if adb is running, as described above).
Is the emulator hanging waiting to load blocks?
If the emulator had gotten through the entire startup sequence, started loading your app and hangs waiting for blocks, then there might be a bug in your program that is preventing the blocks form being loaded. Check your program in the designer and blocks editor. If you need help, file and issue and include the program source (aia file).

Other Emulator issues

My app runs on the emulator, but images do not appear.
Some people have observed a problem where the app runs on the emulator, but images do not appear. To fix this, reload the App Inventor page in your browser. (Use shift-reload to also reload the cache.) Then try connecting to the emulator again.
When connecting to the emulator, App Inventor says: "Network Error Communicating with Companion. Try resetting the Companion and reconnecting."
This message means that App Inventor believes that it's connected (to the emulator), but it is getting no response from the AI Companion software that should be running in the emulator. There are several possible possible different and we're currently updating the setup tools to fix as many as we can. In the meantime, one thing to try is to delete .appinventor folder of your home directory and try connecting to the emulator again. And try starting connecting two or three times. If these reconnect attempts don't work, try resetting the AI companion program. Use the menu key (on the emulator) and select "stop this application". Then reload the browser page, and try connecting again. If the doesn't help, kill the emulator window, reload the browser page, and try again. If this still does not work, please report an issue.
Is a firewall blocking aiStarter or the emulator?
If the emulator loads and starts, but then you see an error that there is a problem communicating with the Companion, one possible (but unlikely) cause is that a firewall is blocking connections between App Inventor and the emulator. Windows and MacOS both come with firewalls included with the operating system. Neither of these should create problems for App Inventor, but your computer might have other firewall software installed (for example, AVG link scanner). If it does, you'll need to configure that firewall to allow both aiStarter and emulator.exe through.
Can your computer see the rendez-vous server?
Using your browser (not App Inventor) try to visit the page at http://rendezvous.appinventor.mit.edu. It should look like a copy of the App Inventor page (but it is not the App Inventor service, so don't try to use it as that). If you cannot visit it this page, the App Inventor will not work. Check with network provider to determine why this connection is blocked.
To be continued as we get more experience ...

<<Back to Setup Emulator Connection

<<Back to Main Setup Page