LiveCode Mobile Development Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Time for action — starting an Android virtual device

You will have to do a little digging deep into the Android SDK folders to find the Android Virtual Device setup program, and you might well want to make a shortcut or alias to it for quicker access.

  1. Navigate to the Android SDK tools folder, located at C:\Program Files (x86)\Android\android-sdk\ on Windows, and in your Documents:android-sdk-macosx:tools folder on Mac.
  2. Open AVD Manager on Windows, or Android on Mac (it looks like a Unix executable - just double-click on it, and the application will open via a command-line window).
  3. If you're on Mac, select Manage AVDs… from the Tools menu.
  4. Select Tablet from the list of devices (there are only two when you have first installed the android SDK - you can add your own custom ones here as well).
  5. Click on the Start button.
  6. Sit patiently while the virtual device starts up!
  7. Open LiveCode, and create a new Mainstack, and Save the stack to your hard drive.
  8. Select File | Standalone Application Settings….
  9. Click on the Android icon, and select the Build for Andoid check box.
  10. Close the Settings dialog box, and take a look at the Development menu.
  11. If the virtual machine is up and running, you should see it listed in the Test Target submenu.

What just happened?

You have opened up an Android virtual device, and LiveCode will be able to test the stacks using that device, once it has finished loading.

Connecting a physical Android device

Connecting a physical Android device can be extremely straightforward:

  1. Connect your device by USB.
  2. Look at the Development Test Target submenu to see it listed.

There can be problem cases though, and Google Search will become your best friend before you are done! We should look at an example problem case to give you ideas on how to solve any similar situations you may encounter.

Using a Kindle Fire

When it comes to finding Android devices, the Android SDK recognizes a lot of them automatically. Some devices are not recognized, and you have to do something to help Android Debug Bridge (ADB) find them.

ADB is the part of the Android SDK that acts as a go-between from your device to any software that needs to be able to access the device. In some cases, you will need to go into the Android system on the device to tell it to allow access for development purposes. For example, on an Android 3 (Honeycomb) device, you need to go into Settings | Applications | Development, and activate the USB debugging mode.

Kindle Fire comes with USB debugging already enabled; you don't have to do anything, but the ADB system doesn't know about the device at all. You can fix that!