Eclispe daytoulouse combining the power of eclipse with android_fr_1024_768_slideshare

2,270 views
2,290 views

Published on

Cette présentation a été donnée à l'Eclipse Day Toulouse 2012 par Android2EE - Mathias Seguy (1/2h).

L’objectif est de présenter l'utilisation du plugin Android pour eclipse, en particulier la Vue DDMS. Cette présentation se finit par la mise en place de la chasse d'une fuite mémoire dans un programme Android avec l'utilisation du Heap dump et du plugin MAT d'eclipse (Memory analysis Tool).

Cette présentation est une présentation d’Android2EE, entreprise spécialisée dans l’expertise, le consulting et la formation Android. Vous souhaitez apprendre la programmation Android, Android2EE vous accompagne au-travers ses EBooks ou ses formations.
Laissez moi vous raconter mon histoire concernant cette entreprise. En 2010, je me suis penché sur la technologie Android, j’ai écrit trois EBooks sur l’art de la programmation Android (disponible sur Android2EE). J’ai quitté ma précédente entreprise et j’ai créé l’entreprise Android2EE (Android To Enterprise Edition) dont l’objectif est la formation, l’expertise et le consulting Android. J’ai quelques contrats en tant que consultant et aussi en tant que formateur. J’ai monté un ensemble de formations Android pour les entreprises:

Formation Initiale : Devenir autonome (3j).
Formation Approfondissement (2j).
Formation Spécificité Tablette et Graphisme(2j).
Formation Applications complexes (2j).
Formation chef de projet - responsable technique (1j).
Formation Mutlimédia (2j).
Formation sur mesure (2 à 3j).

Je pratique ces formations en donnant des cours dans les universités et les écoles d’ingénieurs de Toulouse ainsi que dans de grandes conférences Java:
CESI-EXIA, EPITECH, Sup-Info, IUP ISI, InfoSup, IUP SI, IUP ISI, IngeSup, INSA
Et bien sûr: Devoxx France (LA conférence Java française de 2012), Mercredi 18 Avril 2012,
Et
JCertif Afrique 2012 (LA conférence Java du continent Africain) Septembre 2012 Conférence et Cours

Enfin, j’ai investi l’espace numérique, voici quelques uns des ces sites:
http://www.android2ee.com/
http://mathias-seguy.developpez.com/
http://blog.developpez.com/android2ee-mathias-seguy/
http://android2ee.blogspot.com/
La critique de mon livre « Android A Complete course » par developpez.com (dont je ne suis pas peu fier, quand même):
http://android.developpez.com/livres/#L9791090388000

J’ai des articles sur Developpez.com concernant Android.
Ah oui, j’oubliais, mon cv se trouve ici (si jamais) : http://mathias-seguy.developpez.com/MathiasSeguyCV201106/

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,270
On SlideShare
0
From Embeds
0
Number of Embeds
733
Actions
Shares
0
Downloads
11
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Eclispe daytoulouse combining the power of eclipse with android_fr_1024_768_slideshare

  1. 1. presents:Android Java J2EE Specialist Author ofavailable on 1
  2. 2. •Android in numbers•Installing the work space•Creating a project•Using DDMS perspective•Using DDMS perspective and Eclipse Debug Bridge•Tracking memory leaks 2
  3. 3. Android Trainer Consultant Expert mathias.seguy.it@gmail.com (mail) @android2ee (twitter) Author of eBooks on Android programming (Android2ee.com) Android Speaker and Teacher Fundamentals Mathematics Doctor Technical expert of the “Agence Nationale de la Recherche” Developpez.com Redactor Android Blogs : Android2EE sur DVP et Android2ee sur BlogSpotFundamentals Mathematics Android2EE PHD Via CapGemini Via Sopra Birth Siemens Magnus DGA CNES Airbus Airbus Airbus STI Android2 VDO EE 03 04 05 06 07 08 09 10 11 12 Java J2EE Android Manager Manager Technical Developer Developer GUI Leader Technical Technical Manager Technical Director Android2EE Leader Leader Leader FounderENSEEIHT‟s IT At STI Master 3
  4. 4. 4
  5. 5. •2003 Android Inc creation•2005 Google bought Android•2007 Open Handset Alliance birth•2007 Android Beta SDK released In 3 years, from September 2008 to November 2011, 8 major versions of the system are delivered by Google 5
  6. 6. Android in numbers:• 27% of mobiles are smart phones (World Wild, 2011);• 52.5% of smart phones are Android phones (World Wild, Dec 2011);• 1 smart phone over two sold is an Android Phone (US, Dec 2011);• +17391% of available applications on GooglePlay in 3 years;• +500 000 applications in GooglePlay (April 2012);• +15 000 000 downloads (May 2012);• 2012 will be the Android Tablet year.Ok, today, Android is the smart phones OS winner.But tomorrow, Android will be everywhere: mobile, tablet, TV, watches, Hifi, car, appliances, home automationEverywhere, I tell you. 6
  7. 7. 7
  8. 8. It‟s pretty easy:First:• Download Java (http://www.oracle.com/technetwork/java/javase/do wnloads/index.html) and install it;• Download Eclipse (http://www.eclipse.org/downloads/) and install it;• Download the Android SDK (http://developer.android.com/sdk/index.html) and unzip it.In Eclipse, add the Android plugin:• Go in Help/install New software. Click Add and set Android and https://dl- ssl.google.com/android/eclipse/• Select all the elements, click next and finish.Restart Eclipse :• In WindowPreference select Android et set the Android SDK path (the folder in which you unzip the Android SDK)Ok, it‟s done, you can code Android program.
  9. 9. Now open the SDK ManagerAnd launch the update/installation (Android SDK Tools, platform-tools, SDK, documentation,…).A long download is waiting for you.Then define Android Virtual Device (Emulator) for tests.
  10. 10. Now open the SDK ManagerA quick glance at the window.
  11. 11. Open the AVD window.
  12. 12. Open the AVD window.Select new.Define a new Emulator:• Name• Target• SD card size• Skin (resolution)• Hardware
  13. 13. 13
  14. 14. Let‟s create a first project a see :• Android “new project” Wizard• Android Manifest wysiwyg• Android Layout wysiwyg• Android resources wysiwyg 14
  15. 15. Let‟s create a first project a see :File->new->Others…-> Android Project and follow the wizard:Project Name, Project SDK to target, 15
  16. 16. Let‟s create a first project a see :File->new->Others…-> Android Project and follow the wizard:Project Name, Project SDK to target, Application name, Package name, Activity name, min SDK,Project created 16
  17. 17. 17
  18. 18. 18
  19. 19. 19
  20. 20. 20
  21. 21. Open the DDMS perspective.• Devices• Emulator Control• Set of action buttons• File Explorer• Resource explorer• Lint Warning• LogCat 21
  22. 22. Status Version/Tid/PidDevices Connected Avaiable Processes to watch 22
  23. 23. Control the emulator telephony status Emulate a phone call to the emulator Emulate the reception of an SMSControl the emulator geo-location using: Your own lat/long A GPX file A KML file 23
  24. 24. Screen Debug Heap Thread Stop Capture Take a screen shootStrart the « Debug » Stop a process on a Process Begin CPU time Begin the Heap Cause Garbage tracking tracking using the Collector usefull to Heap View update heap stats Begin threads tracking using the Dump the Heap Threads View within Eclipse (using MAT) or in a file 24
  25. 25. Create a folder Delete a filePush a file onto the devicePull a file from the device 25
  26. 26. Ressources used by the processSelected process 26
  27. 27. List all the problems found in the workspace, a PMD like dedicated to AndroidDescription Category Location Description of the rule 27
  28. 28. 28
  29. 29. 29
  30. 30. Using the Debug mode withthe DDMS perspective.• Allocation tracker• Heap tracking• Threads tracking• Heap Dump 30
  31. 31. 31
  32. 32. 32
  33. 33. 33
  34. 34. 34
  35. 35. 35
  36. 36. It‟s quiet simple: Thread I.H.M Thread de traitementLink an activity with a life cycle and a Activity Handler thread with no management sendMessage( between the thread lifecycle and the ) message OnDestroy() OnCreate() Thread de traitement initiale Thread I.H.M sendMessage () Activity Handler fantôme fantôme Thread de traitement Activity Handler sendMessage( ) message 36
  37. 37. Application MainActivity Handler Thread 1 37
  38. 38. Application MainActivity 1 Handler 1 Thread 1 MainActivity 2 Handler 2 Thread 2 38
  39. 39. Application MainActivity 1 Handler 1 Thread 1 MainActivity 2 Handler 2 Thread 2 MainActivity 3 Handler 3 Thread 3 39
  40. 40. Shallow heap is the memory consumed by one object. GC Root S=100Retained set of X is the set of objects which would be R=400removed by GC when X is garbage collected.Retained heap of X is the sum of shallow sizes of all objectsin the retained set of X, i.e. memory kept alive by X.Generally speaking, shallow heap of an object is its size in theheap and retained size of the same object is the amount of S=100 S=100heap memory that will be freed when the object is garbage R=200 R=100collected. S=100 R=100 40
  41. 41. Using the Debug mode withthe DDMS perspective.• Allocation tracker• Heap tracking• Threads tracking• Heap Dump• Save the heap,• Convert the heap using: hpro-conv dump.hprof dump-converted.hprof• D:Eclipseeclipsex64_indigo_Androidandroid-sdktools>hprof-conv.exe D:AndroidConferenceEclipseDayToulousehrpofcom.android2ee.tuto.thread.orphan.hprof D:AndroidConferenceEclipseDayToulousehrpofcom.android2ee.tuto.thread.orphan.converted.prof 41
  42. 42. • Open it in MAT the converted hprof • Dominator tree => We detect our Thread 42
  43. 43. • Open it in MAT the converted hprof • Dominator tree => We detect our Thread 43
  44. 44. • Now, open the Histogram View • Choose byte[] and select “list object with incoming reference” 44
  45. 45. • Now, open the Histogram View • Choose byte[] and select “list object with incoming reference” • Open the items and fall on your class and select “list object with incoming reference” 45
  46. 46. • Now, open the Histogram View • Choose byte[] and select “list object with incoming reference” • Open the items and fall on your class and select “list object with incoming reference” • Find again the duplicated activity 46
  47. 47. • Now, open the Histogram View • Choose byte[] and select “list object with incoming reference” • Open the items and fall on your class and select “list object with incoming reference” • Find again the duplicated activity  Open one of then and Just look at the Handler and the Background Thread => Leak Resolved 47
  48. 48. This presentation has used the following references: • Android2ee„s Ebooks and tutorials : http://www.android2ee.com • Android web sites: • http://developer.android.com/index.html • http://android-developers.blogspot.fr/ • http://www.google.com/events/io/2011/sessions.html • Android Design Guide: http://developer.android.com/design/index.htmlOn Android2ee, you‟ll find the following tutorials: • Sensors • Threads, handlers and memory leaks • AppWidgets • Dynamic GUI creation • REST Services • RSS reader • Use Maven for Android projects • Deliver on GooglePlaySur developpez.com vous trouverez les articles suivants (français seulement): •Déployer son application Android et obtenir sa clef MapView. •Construire dynamiquement ses IHM Android •Les capteurs Android •Thread, Handler, AsyncTask et fuites mémoires •Investir lécran daccueil Android avec les AppWidgets •Android, Livrer son projet sur GooglePlay 48
  49. 49. . Thanks for your attention. android2ee.com. See you in: Brazzaville #android2ee In September mathias.seguy.it@gmail.comMySensors, MyLight et MyTorch available on GooglePlay 49

×