180 likes | 262 Views
Android Unit 2: First Project. Running the Project on an Attached Device Instead of an Emulator. Being able to use the emulator is important—but it can occasionally be problematic Being able to run an app on an actual attached device is no less important—and it can be no less problematic.
E N D
Android Unit 2: First Project Running the Project on an Attached Device Instead of an Emulator
Being able to use the emulator is important—but it can occasionally be problematic • Being able to run an app on an actual attached device is no less important—and it can be no less problematic
If you haven’t yet run a homemade app on your device, there are essentially 3 steps: • 1. Getting the Device Ready • You have to get into developer mode so that you it’s possible to transfer the app to the device
2. Downloading and Installing the Driver • You need a USB driver in order to transfer through a USB port • 3. Running the App on the Device • Then you can run the app on the device
For reference purposes, these overheads were prepared with the following: • Windows 7 • Eclipse, as already described • A Nexus 7 tablet • The fact that it was the Nexus 7 tablet is relevant to the specific instructions for getting the device ready
Getting the Device Ready • On the running device, go to the App screen • Tap on Settings • Under System, find About tablet • Tap Build number 7 times • When you return from doing this you should find Developer options under System
Take Developer options • Under Debugging, enable USB debugging • You can now connect the device to your system using a USB cable
Downloading and Installing the Driver • For information on the Nexus 7 USB driver, if you want any, go to the Android Web site: • http://developer.android.com • A search on “USB driver” will take you to a page that has information on the driver • The driver is only necessary when developing in a Windows environment
You have a choice on getting the driver • Either you can download from this page • Or you can use the Android SDK Manager from the ADT bundle in Eclipse • If you’re following this set of overheads and not using your own development environment, using the SDK Manager is easier
Using the manager is so easy, there’s not much to say about it • Click on the Android SDK manager tool in the Eclipse environment • Find the line for the driver • Click and follow any instructions
What Can Be Problematic • The premise of this section is that you are trying to set this up on your own machine • Various versions of Windows will sometimes try to use a generic Windows driver instead of the Google driver • This can be a serious problem • On some systems, it appears to be impossible to prevent Windows from doing this • If that happens, you will be unable to run an app on an attached device
It may also be possible to manually replace a Windows driver with the Google driver • Here is a brief list of steps for downloading and installing the driver: • Note which folder the driver is saved in • Right click on the “computer” icon on your machine • Take the Manage option • Select the Device Manager on the left • Find and expand the Other devices
Find the Nexus 7 device in the list • You may find the Nexus 7 device somewhere else depending on your situation • When you find the Nexus 7 device, right click on it • Take the Update Driver Software… option • Follow the directions and browse to the location where the driver was saved to
Running the App on the Device • The assumption is that you successfully installed the driver and your device is attached with a USB cable • Open your app in Eclipse • Take the Run tool or the Run option in the menu • This should cause the Android Device Chooser to appear on the screen, with the Nexus 7 device in the list • A screen shot is shown on the following overhead
Select your device and click OK • The app should run on your device • In addition to running, it will be installed on the device • If you go to the apps screen you’ll find the little green Android icon with the name of the app and you can run it from there in the future
Summary and Mission • This is the end of the description of the first project • As noted, it was only about nuts and bolts • The presentation had nothing to do with code or the components of the app • Those topics will be pursued in the following sets of overheads
You have two missions: • 1. Get “Hello World” to work on an emulated virtual device in whatever development environment you’re using • 2. Get “Hello World” to work on a real attached Android device