Top Banner
Ra#onalize Android development with StAnD Clement Escoffier, akquinet A.G.
30

Rationalize Android Development with StAnD - Clement Escoffier, akquinet

Dec 05, 2014

Download

Technology

 
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

Ra#onalize  Android  development  with  StAnD  

Clement  Escoffier,  akquinet  A.G.  

Page 2: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

What  about  me  ?  

 ¡  Head  of  the  Innova=on  Competence  Center  at  akquinet  ¡  Apache  So@ware  Founda=on  

–  PMC  Apache  Felix,    Apache  Ace  –  Apache  Felix  iPOJO  main  developer  

¡  OW2  –  Chameleon  project  leader  

¡  A  lot  of  others  contribu=ons    –  maven-­‐android-­‐plugin  –  H-­‐UBU  

Copyright  ©  2010  –  akquinet  AG   2  

Page 3: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

The comScore 2010 Mobile Year in Review FEBRUARY 2011

PAGE 16

22001100 MMoobbiillee MMeeddiiaa CCoonnssuummppttiioonn Mobile Media Usage More Common in U.S. than Europe Throughout the past year, mobile media adoption has continued to grow, as consumers are increasingly turning to their mobiles for many other uses beyond just talking or even texting. Since December 2009 the number of mobile media users has grown significantly in the U.S. as well as across the EU5. 109 million U.S. mobile subscribers (46.7 percent of the total audience) accessed mobile media (browsed, accessed applications or downloaded content or accessed the mobile Internet via SMS) in December 2010, up 7.6 percentage points versus year ago. Europeans displayed a similar adoption rate with 41.1 percent of mobile users accessing mobile media in December 2010 compared to just 35.3 percent in December 2009.

.

3  

Page 4: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

Copyright  ©  2010  –  akquinet  AG  

4  

Page 5: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

I  love  driving  developers  

crazy  

Copyright  ©  2010  –  akquinet  AG  

5  

Page 6: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

Tradi#onal  Android  development  

6  Copyright  ©  2010  –  akquinet  AG  

•  Eclipse  Android  Development  •  Development,  Tests,  Debug  •  Export  and  signature  of  APKs  •  Limited  modularity  •  Eclipse-­‐based  build  process  •  No  release  process  (export  wizard)  

•  Apache  Ant  •  Compila=on,  Test,  Packaging  •  Release  •  Dependencies  management  •  Hard  to  maintain  –  Scalability  –  Recursion  •  Can  quickly  differ  from  standard  builds  

Page 7: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

StAnD  

7  Copyright  ©  2010  –  akquinet  AG  

•  Let’s  ra#onalize  Android  development  •  Support  Android  applica=on  produc=on  from  development  to  delivery  

•  Simplifica#on  of  the  development  model  •  Bootstrap  a  project  in  less  than  1  minute  •  Improve  the  logging  system  (Androlog)  •  Injec=on  framework  (Roboject)  

•  Reliable  build  and  sophis#cated  branding  •  Maven-­‐based  build  system  (maven-­‐android-­‐plugin)  •  Advanced  modularity  and  composi=on  (rindirect)  

•  Improve  quality  and  feedback  •  Integra=on  and  UI  tests  (Marvin)  •  Con=nuous  integra=on  (Android  plugin  for  Jenkins)  •  Complete  crash  report  (Androlog)  

Page 8: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

Copyright  ©  2010  –  akquinet  AG  

8  

This   is   a   work   of   ficFon.   Names,   characters,    places   and   projects   are   all   products   of   the  author’s   imaginaFon.     Any   resemblance   to  actual   events,   locales   or   projects   is   enFrely  coincidental  ;-­‐)  

Page 9: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

Once  upon  a  #me…  a  project  

•  An  eBook  Reader  

•  DRM  •  Na=ve  library  •  Server  integra=on  •  Tethering  

•  Library  /  Vault,  Book  Store  •  Server  integra=on  

•  Social  aspect    •  Friends,  Sharing,  Loaning  

•  Mul=-­‐pladorm  •  iOS,  Android,  Desktop  (MacOS  /  Windows)  •  Synchroniza=on  

•  >  2  years  of  ac#ve  development  

Copyright  ©  2010  –  akquinet  AG   9  

Page 10: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

10  Copyright  ©  2010  –  akquinet  AG  

Version 1

•  Eclipse •  2 developers •  Native lib integration

o  No tests o  Log statements

removed before release

o  Facing Java / Android API differences

Page 11: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

11  Copyright  ©  2010  –  akquinet  AG  

Version 1

•  Eclipse •  2 developers •  Native lib integration

o  No tests o  Log statements

removed before release

o  Facing Java / Android API differences

Page 12: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

A  bit  beMer  

12  Copyright  ©  2010  –  akquinet  AG  

Version 1

•  Eclipse •  2 developers •  Native lib integration

o  No tests o  Log statements

removed before release

o  Facing Java / android APIs differences

Version 2

•  New features •  Bad ratings •  Bigger team

o  Androlog o  Testing using

instrumentation tests o  Apache Ant

Page 13: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

Androlog  

Androlog  is  a  configurable  log  facade  for  Android  

•  Per-­‐logger  level  configura#on  •  Log  disabled  on  end-­‐user  devices  •  Can  be  enabled  by  developers  to  reproduce  issues  

•  Repor#ng  •  Crashes  can  be  reported  by  mail  or  a  portal  •  Device  info  •  Log  •  Complete  stack  traces  

•  Makes  logging  a  lot  easier  •  Faster  bug  fixes  

13  Copyright  ©  2010  –  akquinet  AG  

Page 14: Rationalize Android Development with StAnD - Clement Escoffier, akquinet
Page 15: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

A  bit  beMer  

15  Copyright  ©  2010  –  akquinet  AG  

Version 1

•  Eclipse •  2 developers •  Native lib integration

o  No tests o  Log statements

removed before release

o  Facing Java / android APIs differences

Version 2

•  New features •  Bad ratings •  Bigger team

o  Androlog o  Testing using

instrumentation tests o  Apache Ant

Page 16: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

A  bit  beMer  

16  Copyright  ©  2010  –  akquinet  AG  

Version 2

•  New features •  Bad ratings •  Bigger team

o  Androlog o  Testing using

instrumentation tests o  Apache Ant

Version 3

•  Brandings •  Quality++ •  New features

o  Maven o  Jenkins o  Marvin o  Became really

complex

Page 17: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

Maven-­‐Android-­‐Plugin  

Reliable  build  system  

•  Same  build  on  all  machines  •  Conven=on  over  configura=on  •  Con=nuous  integra=on  support  •  Dependency  management  •  Modularity  /  Branding  

•  Release  process  •  Create  marketplace-­‐ready  APK  

•  Archetypes  •  Quickstart,  with-­‐test,  release,  stand  

•  More  reliable  •  More  maintainable  •  Release  process  

17  Copyright  ©  2010  –  akquinet  AG  

Page 18: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

Android  plugin  for  Jenkins  /  Hudson  

Tests  Android  applica#ons  con#nuously  on  several  plaVorms  

•  1.6  to  3.1  •  A  lot  of  devices  are  available  •  Huge  Fragmenta=on  (1.6)  

•  Tests  executed  on  25  devices  •  Covering  the  most  common  devices  •  Emulator  configura=ons  

•  More  reliable  applica#ons  •  Less  surprises  especially  when  using  internals  

 

18  Copyright  ©  2010  –  akquinet  AG  

Page 19: Rationalize Android Development with StAnD - Clement Escoffier, akquinet
Page 20: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

Marvin  –  Simplify  Integra#on  Tests  

Instrumenta#on  tests  are  …  really  annoying  to  write  !  

•  Android  instrumenta=on  tests  •  A  lot  of  asynchronocity  •  Tests  don’t  easily  navigate  across  ac=vi=es  •  UI  Tests  are  big  burdens  

•  Marvin  simplifies  test  wri=ng  •  A  layer  on  the  top  of  instrumenta=on  tests  •  A  set  of  hamcrest  matchers  •  Integrated  into  the  build  process  

•  Reduce  the  amount  of  code  required  to  write  tests  •  Support  complex  workflows  •  More  reliable  applica#ons  

  20  Copyright  ©  2010  –  akquinet  AG  

Page 21: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

public void testLogin() throws Exception {! Instrumentation instr = getInstrumentation();!! ActivityMonitor monitor =

!instr.addMonitor(MainActivity.class.getName(), null, !false);!

Intent intent = new Intent(Intent.ACTION_MAIN);! intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);! intent.setClassName(instr.getTargetContext(), !

!LoginActivity.class.getName());! instr.startActivitySync(intent);! instr.waitForIdleSync();! instr.sendStringSync(“clement");! instr.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_DOWN);! instr.sendStringSync(“magic");! instr.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_DOWN);! instr.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_CENTER);!! Activity mainActivity =

!instr.waitForMonitorWithTimeout(monitor, 30000);! assertNotNull(mainActivity);!}!

Page 22: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

public void testLogin() throws Exception {! LoginActivity loginActivity =

!startActivity(LoginActivity.class);! assertThat(loginActivity)

!.sendString(”clement") !.keyDownUp(KeyEvent.KEYCODE_DPAD_DOWN) !.sendString(”magic") !.keyDownUp(KeyEvent.KEYCODE_DPAD_DOWN) !.keyDownUp(KeyEvent.KEYCODE_DPAD_CENTER) !.startsActivity(MainActivity.class);!

}!

Page 23: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

From  a  bit  beMer  …  to  being  efficient  

23  Copyright  ©  2010  –  akquinet  AG  

Version 2

•  New features •  Bad ratings •  Bigger team

o  Androlog o  Testing using

instrumentation tests o  Apache Ant

Version 3

•  Brandings •  Quality++ •  New features

o  Maven o  Jenkins o  Marvin o  Became really

complex

Version 4

•  More brandings •  Quality++ •  Socialization

o  Rindirect o  Roboject

Page 24: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

Rindirect  

Sophis#cated  modularity  for  Android  

•  Android  does  not  support  reusing  components  from  another  applica=on  •  Package  conflict  •  Resources  not  found  in  R  

•  Libraries  do  share  the  same  package  

•  Rindirect  removes  those  limita=ons  by  genera=ng  the  missing/required  R  files  •  Automated  during  your  build  process  

•  Allow  advanced  modularity  •  Improve  component  sharing  

 

24  Copyright  ©  2010  –  akquinet  AG  

Page 25: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

Roboject  

A  CDI  for  Android  

•  Android  code  can  be  really  =resome  •  A  lot  of  asynchronocity  •  Service  bindings,  intents…  •  Predominance  of  the  main  thread  

•  UI  code  can  be  smaller  •  Retrieving  a  View,  Senng  a  Layout  

•  Roboject  dras=cally    simplifies  Android  code  •  @InjectX  where  X  is  Service,  Intent,  Extra,  View,  Layout…  •  Addi=onal  lifecycle  method  :  onReady  

•  Reduce  the  amount  of  code  required  to  develop  Android  applica#ons  

•  Minimum  run#me  overhead  •  Extensible  

  25  Copyright  ©  2010  –  akquinet  AG  

Page 26: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

@InjectLayout(R.layout.searchinputactivity)!public class TweetSearchActivity extends RobojectActivity {! @InjectView! private EditText editTextSearch;!! @InjectView! private Button buttonSearch;!! @Override! public void onCreate(Bundle savedInstanceState) {! super.onCreate(savedInstanceState);!! buttonSearch.setOnClickListener(new OnClickListener() {! public void onClick(View arg0) {! Intent intent = new Intent(TweetSearchActivity.this, !

! !TweetListActivity.class);! intent.putExtra("searchTerm”, ! !!

! ! !editTextSearch.getText().toString());! startActivity(intent);! }! });!

}!}!

Page 27: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

From  a  bit  beMer  …  to  being  efficient  

27  Copyright  ©  2010  –  akquinet  AG  

Version 2

•  New features •  Bad ratings •  Bigger team

o  Androlog o  Testing using

instrumentation tests o  Apache Ant

Version 3

•  Brandings •  Quality++ •  New features

o  Maven o  Jenkins o  Marvin o  Became really

complex

Version 4

•  More brandings •  Quality++ •  Socialization

o  Rindirect o  Roboject

Page 28: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

An  example  would  be  useful  right  about  now  

If  we  have  Fme…  

Page 29: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

StAnD  

ü Androlog  ü Maven-­‐Android-­‐Plugin  ü Jenkins  Plugin  ü Marvin  ü Rindirect  ü Roboject  ü Enterprise  Extensions  

Copyright  ©  2010  –  akquinet  AG   29  

Page 30: Rationalize Android Development with StAnD - Clement Escoffier, akquinet

Q  &  A  

Questions ?

Copyright  ©  2010  –  akquinet  AG   30  

hYp://stand.spree.de