Getting Started with Android Programmingx

Download Report

Transcript Getting Started with Android Programmingx

Getting Started with Android
Programming
Note: if you have already installed
android development tools, please
check that you have the same version as
described here
App Presentation
•
•
Are you hungry?
Presentations
– Talk about a cool app
•
•
•
•
Download the app or apps (yes, you might need to pay a few bucks)
PPT Slides with app views
Compare to existing apps
Use/search for app reviews
– Talk about something interesting in mobile computing
•
•
E.g., android on Intel, qualcomm android tools, new/old company
A few slides and be prepared to answer (tough) questions
– 15 minutes max, but in depth (we are all experts)
– Be prepared. If you are not prepared (i.e., haven’t spent enough time figuring everything out),
ask to present next time. Don’t waste our time.
•
Web site that talk about apps and mobile technology (you should know keep up to
date with these)
– techcrunch.com
•
http://www.crunchbase.com/
– Techstars App showcase: http://techstars.appstores.com/
– Kichstarter.com
•
http://www.kickstarter.com/discover/categories/technology?ref=sidebar
– http://www.businessinsider.com/sai
•
Search on android app and find many articles on different apps
– http://allthingsd.com/
platform
• I will use windows
• Linux is fine
• You can use MAC, but will need to be a fairly
experienced MAC user. Otherwise, try using a
windows virtual machine or, if your machine
can boot into windows, use that.
• You must download and view powerpoint
documents in class
Adobe Connect
• Go to
– http://udel.adobeconnect.com/bohacek
• Log in as guest
Get Eclipse
• Complete information is also here:
http://developer.android.com/sdk/installing.html
• Download Eclipse Indigo Classic (v3.7.1)
– http://www.eclipse.org/downloads/packages/eclipse-classic371/indigosr1
– Note, if you have eclipse, please upgrade to Eclipse Classic
v3.7.1, that way, we all have the same version.
• After downloaded, decompress in a directory name eclipse
• Note, there is no installation for eclipse. Once it is
decompressed, you are ready to run it. But you can only
start eclipse by opening a file browser and double clicking
on eclipse.exe
Get JDK
• Go to
http://www.oracle.com/technetwork/java/jav
ase/downloads/index.html
• Get JDK6 or JDK5 (not JDK7 and not JRE)
– http://www.oracle.com/technetwork/java/javase/
downloads/index.html
– Scroll down a bit to JDK 6
– Perhaps you already have JDK5 or 6
• Check c:\program files\java\jdk1.X.yyy, where X=5 or 6
Get Android SDK
• Go to http://developer.android.com/sdk/index.html
• Install
– Will check that the correct version of jdk is installed.
– install in c:\Android
• After installing SDK, the SDK manager should run
– Select SDK Platform-tools
– Download each API version (or at least the ones >2.0)
• However, don’t download every package within the API version (it
takes to long). Instead, select SDK platform, samples, google api
and then the package for you phone.
– Also, download Android Support package
– And, google USB Driver package
Install ADT Eclipse plugin
•
•
•
•
•
•
For instructions, also see http://developer.android.com/sdk/eclipseadt.html#installing
Start eclipse
Help –> install new software
Click Add, in the top-right corner.
In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and
the following URL for the Location: https://dl-ssl.google.com/android/eclipse/
Click OK
– Note: If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of
"https" (https is preferred for security reasons).
•
•
•
•
•
In the Available Software dialog, select the checkbox next to Developer Tools and
click Next.
In the next window, you'll see a list of the tools to be downloaded. Click Next.
Read and accept the license agreements, then click Finish.
When the installation completes, restart Eclipse.
Configuring the ADT Plugin
– Select Window > Preferences... to open the Preferences panel (Mac OS
X: Eclipse > Preferences).
– Select Android from the left panel.
– You may see a dialog asking whether you want to send usage statistics to Google. If so, make
your choice and click Proceed. You cannot continue with this procedure until you
clickProceed.
– For the SDK Location in the main panel, click Browse... and locate your downloaded SDK
directory. (maybe it is already correctly filled in)
– Click Apply, then OK.
Subclipse
• In Eclipse
– Help -> install new software
– Select add
– In location,
put http://subclipse.tigris.org/update_1.8.x
Play with our set up
•
Enable USB debugging on you phone
–
–
Go to settings
Approach 1 (depends on phone)
•
•
•
–
Approach 2
•
•
–
Look around and check USB debugging
Start eclipse
Window -> open perspective -> other -> DDMS (! Not <DDMS>)
Plug your phone via usb
Under devices (upper left) you can see your phone
–
•
{} Developer options
Check USB debugging
Approach 3
•
•
•
•
•
Open Applications
Development
Check USB Debugging
If you can’t see you phone, check if you have a notification on you phone asking about whether to use USB debugging. Do not
select USB storage
In the upper middle, select the File Explorer tab
–
Expand mnt
•
Expand sdcard
–
–
Expand data
•
•
Should not work, since this is a protected directory that holds apps private data
On the lower/middle left, select LogCat. This shows system messages.
–
The messages are have level (debug, error, info,…)
–
–
Messages have tags and text
We will use these messages extensively for debugging
•
•
Expand DCM
»
Expand Camera
•
This is where your pictures are
You can select which messages using the menu in the middle right
Near the top is a row of buttons. One button is a camera. Click on the camera and see your device screen shot
Play with ADB
• Open a command prompt
• Change dir to c:\android\android-sdk\platform-tools
• > adb devices
– Shows the devices you have plugged in and the serial number
• >adb shell
–
–
–
–
Opens a shell on the device
> ls
>cd /data
>ls
• Still fails
– > su
• If you have rooted you phone, this will succeed
– > ls
• Works!
– > ps
• Shows everything running
Make a Emulated Android Device
•
•
•
•
Start eclipse
Windows -> AVD Manger
Opens a new window (maybe after a short delay)
Select new
–
–
–
–
–
–
Name: Test4
Target: Google APIs API level 15
SD Card Size: 1GiB
Snapshot Enabled
Level screen as default
Click “Create AVD”
• Click on the device you just made and click on start
• It can take sometime to start. Be patient
• You should see the emulator in the eclipse DDMS fairly quickly,
even as the device is booting up