SlideShare una empresa de Scribd logo
1 de 29
Descargar para leer sin conexión
I-Hen Tsai
                 Software Engineer
Delta Electronics Tainan Joint Labs
Requirements
 Android SDK
 Java JDK
 Eclipse IDE
 Some knowledge of Java programming
 A modern computer
 Guts
 And maybe a beer…



                                       2
Setting up the JDK
 Download JDK
  from Oracle
 http://www.oracl
  e.com/technetw
  ork/java/javase/
  downloads/jdk7
  -downloads-
  1880260.html


                     3
Setting up the Android SDK
 http://developer.androi
  d.com/sdk/index.html
 SDK Manager:
  android-sdk-
  windowstoolsandroid.
  bat
 Update as required




                             4
Setting up Eclipse IDE
 http://www.eclipse.org/
  downloads/
 Pick a “Eclipse IDE for
  Java Developers”
  matching your OS
 Unpack your download




                            5
Your new Android project (0)
   On boot, Eclipse will ask where to put your
    projects (your workspace)
   Pick somewhere you wont forget, preferably with a
    lot of space
   Install ADT plugin & restart Eclipse
     https://dl-ssl.google.com/android/eclipse/




                                                        6
Your new Android project (I)
 Start a new “Android Application Project”
 Give it a good name & pick an
  appropriate minimum required SDK




                                              7
Your new Android project (II)
 Pick a launcher icon
 Pick a starting activity
 Pick the navigation style




                                8
Your new Android project (III)
   You should get this screen when you are
    done




                                              9
Your new Android project (IV)
   You can also import an existing project
     Menu: ”File”>>”Import”
     Select Android project and pick the directory
     path for it




                                                      10
Basics
 Each screen is an “activity”
 Activity = code (Java) + UI layout (XML)
 Code controls everything
     Except modifying UI layouts
   UI layout is composed of “widgets”
     A button, an image or a textbox are all
      widgets
     The labels of widgets can be changed by
      code

                                                11
Exploring your project
 src: code
 libs: reference libraries
 bin: compiled apk
 res: all media, layouts, visuals
 res/layout: UI layout of all activities
 AndroidManifest.xml: the heart of
  any Android project
     Permissions
     Declaring components


                                            12
Debugging with Eclipse
   If you want to use your physical device,
    remember to turn on USB debugging
     Settings >> Developer options >> USB
     debugging
 Emulation
 DDMS
 LogCat




                                               13
Setting up an Android emulator (I)
 Menu: “Window” >> “Android Virtual
  Device Manager”
 Select “New”
 Select suitable attributes




                                       14
Setting up an Android emulator (II)
   Start your virtual device first to save time




                                                   15
Emulating your Android
application
 Select one of your source
  files
 Select the green “Run
  [your program name]
  button
 First run only:
     Select run as “Android
      Applicaiton”
     Say “Yes” to LogCat, nyan~!
   Viola!!

                                    16
Emulating your Android
application (II)
   If you didn’t start a virtual device first,
    Eclipse will start one for you
     Automatically selects first compatible device
     Prompts you to create if you don’t have one
     But you have to wait for it to boot
     Might have to run again because it took too
      long for the virtual device to start




                                                      17
Testing with other Android
devices
 Menu: “Run” >> “Run Configurations…”
 Switch to “Target” tab
 Choose “Always prompt to pick device”
 Now you get to choose a device every
  time you run your application




                                          18
DDMS (I)
   Menu: “Window”>>”Open
    perspective”>>”DDMS”




                            19
DDMS (II)
   You can do a lot of things in the DDMS
     File dump
     Fake GPS
     Check CPU load




                                             20
LogCat (I)
 Menu: “Window”>>”Show
  View”>>”Other”>>”LogCat”
 A log of everything computational on the
  Android device




                                             21
LogCat (II)
   You can filter log data by:
     Application
     Debug level
 You can also save the log
 You can use code to send debug data to
  LogCat
     Better than using “push” popup messages




                                                22
Debugging with Android SDK
   Same as DDMS
     android-sdk-windowstoolsandroid.bat




                                               23
Publishing your app
 Compile in “release” config
 APK file
     Mail to people you want to share
     Host on website for download
     etc.
   Publish to Google Play
     Need Google account
     USD 25 registration fee



                                         24
Tricks for demoing
 Make a video capture
 Android emulator
 BlueStacks
 Droid @ Screen




                         25
BlueStacks
 http://www.bluestacks.com/
 Install a custom launcher and you are
  ready to go




                                          26
Droid @ Screen
 http://droid-at-
  screen.ribomation.com/
 Requires Java & a USB
  connection to your
  Android device
 Just specify where your
  /sdk/platform-
  tools/adb.exe resides


                            27
Wrapping it up…
 Read the documentation
 Ask around on StackOverflow
 Plan a lot
 Don’t give up
 Practice makes perfect!
 And remember to have fun 




                                28
29

Más contenido relacionado

La actualidad más candente

La actualidad más candente (7)

Symbian OS - Quick Start
Symbian OS - Quick StartSymbian OS - Quick Start
Symbian OS - Quick Start
 
Native Android for Windows Developers
Native Android for Windows DevelopersNative Android for Windows Developers
Native Android for Windows Developers
 
Getting started with immersive technologies
Getting started with immersive technologiesGetting started with immersive technologies
Getting started with immersive technologies
 
Android wear notes
Android wear notesAndroid wear notes
Android wear notes
 
Ios - Introduction to platform & SDK
Ios - Introduction to platform & SDKIos - Introduction to platform & SDK
Ios - Introduction to platform & SDK
 
Android tutorial1
Android tutorial1Android tutorial1
Android tutorial1
 
Android Development Workshop
Android Development WorkshopAndroid Development Workshop
Android Development Workshop
 

Similar a [CCDD2013w] Coming to grips with deving for android by 蔡亦恒

Mobile application and Game development
Mobile application and Game developmentMobile application and Game development
Mobile application and Game developmentWomen In Digital
 
androidPramming.ppt
androidPramming.pptandroidPramming.ppt
androidPramming.pptBijayKc16
 
Ii 1300-java essentials for android
Ii 1300-java essentials for androidIi 1300-java essentials for android
Ii 1300-java essentials for androidAdrian Mikeliunas
 
[Android] Introduction to Android Programming
[Android] Introduction to Android Programming[Android] Introduction to Android Programming
[Android] Introduction to Android ProgrammingNikmesoft Ltd
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applicationsTOPS Technologies
 
LAP2 iOS and Android Development environment setup
LAP2 iOS and Android Development environment setupLAP2 iOS and Android Development environment setup
LAP2 iOS and Android Development environment setupUniversity of Catania
 
Introduction_to_android_and_android_studio
Introduction_to_android_and_android_studioIntroduction_to_android_and_android_studio
Introduction_to_android_and_android_studioAbdul Basit
 
Android installation
Android installationAndroid installation
Android installationDurai S
 
Getting Enter in Android development
Getting Enter in Android developmentGetting Enter in Android development
Getting Enter in Android developmentGhufran Hashmi
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application Developmentonkar_bhosle
 
Android development tutorial
Android development tutorialAndroid development tutorial
Android development tutorialnazzf
 
Installing iOS and Android Simulators on MacOSX
Installing iOS and Android Simulators on MacOSXInstalling iOS and Android Simulators on MacOSX
Installing iOS and Android Simulators on MacOSXKen Skistimas
 
03 Beginning Android Application Development
03 Beginning Android Application Development03 Beginning Android Application Development
03 Beginning Android Application DevelopmentArief Gunawan
 
Android development tutorial
Android development tutorialAndroid development tutorial
Android development tutorialMohammad Taj
 

Similar a [CCDD2013w] Coming to grips with deving for android by 蔡亦恒 (20)

Android course (lecture2)
Android course (lecture2)Android course (lecture2)
Android course (lecture2)
 
Mobile application and Game development
Mobile application and Game developmentMobile application and Game development
Mobile application and Game development
 
androidPramming.ppt
androidPramming.pptandroidPramming.ppt
androidPramming.ppt
 
Ii 1300-java essentials for android
Ii 1300-java essentials for androidIi 1300-java essentials for android
Ii 1300-java essentials for android
 
[Android] Introduction to Android Programming
[Android] Introduction to Android Programming[Android] Introduction to Android Programming
[Android] Introduction to Android Programming
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applications
 
LAP2 iOS and Android Development environment setup
LAP2 iOS and Android Development environment setupLAP2 iOS and Android Development environment setup
LAP2 iOS and Android Development environment setup
 
Introduction_to_android_and_android_studio
Introduction_to_android_and_android_studioIntroduction_to_android_and_android_studio
Introduction_to_android_and_android_studio
 
Android
Android Android
Android
 
Android installation
Android installationAndroid installation
Android installation
 
Android app upload
Android app uploadAndroid app upload
Android app upload
 
Getting Enter in Android development
Getting Enter in Android developmentGetting Enter in Android development
Getting Enter in Android development
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application Development
 
Anveshan android
Anveshan androidAnveshan android
Anveshan android
 
NDK Introduction
NDK IntroductionNDK Introduction
NDK Introduction
 
Android development tutorial
Android development tutorialAndroid development tutorial
Android development tutorial
 
Installing iOS and Android Simulators on MacOSX
Installing iOS and Android Simulators on MacOSXInstalling iOS and Android Simulators on MacOSX
Installing iOS and Android Simulators on MacOSX
 
03 Beginning Android Application Development
03 Beginning Android Application Development03 Beginning Android Application Development
03 Beginning Android Application Development
 
Android development tutorial
Android development tutorialAndroid development tutorial
Android development tutorial
 
Android - Getting started with Android
Android - Getting started with Android Android - Getting started with Android
Android - Getting started with Android
 

[CCDD2013w] Coming to grips with deving for android by 蔡亦恒

  • 1. I-Hen Tsai Software Engineer Delta Electronics Tainan Joint Labs
  • 2. Requirements  Android SDK  Java JDK  Eclipse IDE  Some knowledge of Java programming  A modern computer  Guts  And maybe a beer… 2
  • 3. Setting up the JDK  Download JDK from Oracle  http://www.oracl e.com/technetw ork/java/javase/ downloads/jdk7 -downloads- 1880260.html 3
  • 4. Setting up the Android SDK  http://developer.androi d.com/sdk/index.html  SDK Manager: android-sdk- windowstoolsandroid. bat  Update as required 4
  • 5. Setting up Eclipse IDE  http://www.eclipse.org/ downloads/  Pick a “Eclipse IDE for Java Developers” matching your OS  Unpack your download 5
  • 6. Your new Android project (0)  On boot, Eclipse will ask where to put your projects (your workspace)  Pick somewhere you wont forget, preferably with a lot of space  Install ADT plugin & restart Eclipse  https://dl-ssl.google.com/android/eclipse/ 6
  • 7. Your new Android project (I)  Start a new “Android Application Project”  Give it a good name & pick an appropriate minimum required SDK 7
  • 8. Your new Android project (II)  Pick a launcher icon  Pick a starting activity  Pick the navigation style 8
  • 9. Your new Android project (III)  You should get this screen when you are done 9
  • 10. Your new Android project (IV)  You can also import an existing project  Menu: ”File”>>”Import”  Select Android project and pick the directory path for it 10
  • 11. Basics  Each screen is an “activity”  Activity = code (Java) + UI layout (XML)  Code controls everything  Except modifying UI layouts  UI layout is composed of “widgets”  A button, an image or a textbox are all widgets  The labels of widgets can be changed by code 11
  • 12. Exploring your project  src: code  libs: reference libraries  bin: compiled apk  res: all media, layouts, visuals  res/layout: UI layout of all activities  AndroidManifest.xml: the heart of any Android project  Permissions  Declaring components 12
  • 13. Debugging with Eclipse  If you want to use your physical device, remember to turn on USB debugging  Settings >> Developer options >> USB debugging  Emulation  DDMS  LogCat 13
  • 14. Setting up an Android emulator (I)  Menu: “Window” >> “Android Virtual Device Manager”  Select “New”  Select suitable attributes 14
  • 15. Setting up an Android emulator (II)  Start your virtual device first to save time 15
  • 16. Emulating your Android application  Select one of your source files  Select the green “Run [your program name] button  First run only:  Select run as “Android Applicaiton”  Say “Yes” to LogCat, nyan~!  Viola!! 16
  • 17. Emulating your Android application (II)  If you didn’t start a virtual device first, Eclipse will start one for you  Automatically selects first compatible device  Prompts you to create if you don’t have one  But you have to wait for it to boot  Might have to run again because it took too long for the virtual device to start 17
  • 18. Testing with other Android devices  Menu: “Run” >> “Run Configurations…”  Switch to “Target” tab  Choose “Always prompt to pick device”  Now you get to choose a device every time you run your application 18
  • 19. DDMS (I)  Menu: “Window”>>”Open perspective”>>”DDMS” 19
  • 20. DDMS (II)  You can do a lot of things in the DDMS  File dump  Fake GPS  Check CPU load 20
  • 21. LogCat (I)  Menu: “Window”>>”Show View”>>”Other”>>”LogCat”  A log of everything computational on the Android device 21
  • 22. LogCat (II)  You can filter log data by:  Application  Debug level  You can also save the log  You can use code to send debug data to LogCat  Better than using “push” popup messages 22
  • 23. Debugging with Android SDK  Same as DDMS  android-sdk-windowstoolsandroid.bat 23
  • 24. Publishing your app  Compile in “release” config  APK file  Mail to people you want to share  Host on website for download  etc.  Publish to Google Play  Need Google account  USD 25 registration fee 24
  • 25. Tricks for demoing  Make a video capture  Android emulator  BlueStacks  Droid @ Screen 25
  • 26. BlueStacks  http://www.bluestacks.com/  Install a custom launcher and you are ready to go 26
  • 27. Droid @ Screen  http://droid-at- screen.ribomation.com/  Requires Java & a USB connection to your Android device  Just specify where your /sdk/platform- tools/adb.exe resides 27
  • 28. Wrapping it up…  Read the documentation  Ask around on StackOverflow  Plan a lot  Don’t give up  Practice makes perfect!  And remember to have fun  28
  • 29. 29