使用模拟器构建应用程序

« 返回首页

App Inventor includes an emulator for the phone. The emulator lets you develop and test apps using a virtual phone instead of a real phone. Instead of connecting a phone to the USB port, just start the emulator program. When you click Connect to Phone in the Blocks Editor, your app will appear in the emulator.

You can’t do everything with the emulator that you can with a real phone — you can’t shake it, for example, and the emulator can’t make or recieve phone calls — but you can use the emulator to create apps and test them, and install them on a phone later if you like.

Starting the Emulator

You don’t need to download any additional software to use the emulator. It was included with the software you already downloaded as part of the App Inventor Extras Package. Navigate to the directory where the App Inventor Extras software was installed, locate the folder called commands-for-appinventor and run the command run-emulator.

Be patient: The emulator takes a long time to start, even a minute or more. That’s because it’s booting up the virtual phone from scratch.

The emulator will appear in its own window on your computer. As you work, you’ll need to switch among the emulator window, the Blocks Editor, and the Designer.

Don’t connect a physical phone to the computer while you’re using the emulator, or App Inventor will become confused.

App Development with the Emulator

Start the emulator and use App Inventor just as you would with a real phone: connect to the App Inventor site, start the Blocks Editor, and press Connect to Phone . Your application should appear in the emulator. Don’t forget to “unlock” the virtual phone after it starts up.

When your app is finished, you can download it to your computer just as you would if you’d been developing on a real phone.

Tips: The emulator provided with App Inventor is the standard Android emulator. You can learn more about it from the Android Emulator section of the Android Developer’s Guide . For example, you might want to download and install a different “skin” to make the virtual phone look different from the default that App Inventor uses.