Contenu connexe
Similaire à Rationalize Android Development with StAnD
Similaire à Rationalize Android Development with StAnD (20)
Plus de Paris Open Source Summit
Plus de Paris Open Source Summit (20)
Rationalize Android Development with StAnD
- 2. 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
- 6. Tradi#onal
Android
development
• 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
Copyright
©
2010
–
akquinet
AG
6
- 7. StAnD
• 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)
Copyright
©
2010
–
akquinet
AG
7
- 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
;-‐)
Copyright
©
2010
–
akquinet
8
- 9. 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
- 10. Version 1
• Eclipse
• 2 developers
• Native lib integration
o No tests
o Log statements
removed before
release
o Facing Java / Android
API differences
Copyright
©
2010
–
akquinet
AG
10
- 11. Version 1
• Eclipse
• 2 developers
• Native lib integration
o No tests
o Log statements
removed before
release
o Facing Java / Android
API differences
Copyright
©
2010
–
akquinet
AG
11
- 12. A
bit
beMer
Version 1 Version 2
• Eclipse • New features
• 2 developers • Bad ratings
• Native lib integration • Bigger team
o No tests
o Log statements o Androlog
removed before o Testing using
release instrumentation tests
o Facing Java / android o Apache Ant
APIs differences
Copyright
©
2010
–
akquinet
AG
12
- 13. 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
Copyright
©
2010
–
akquinet
AG
13
- 15. A
bit
beMer
Version 1 Version 2
• Eclipse • New features
• 2 developers • Bad ratings
• Native lib integration • Bigger team
o No tests
o Log statements o Androlog
removed before o Testing using
release instrumentation tests
o Facing Java / android o Apache Ant
APIs differences
Copyright
©
2010
–
akquinet
AG
15
- 16. A
bit
beMer
Version 2 Version 3
• New features • Brandings
• Bad ratings • Quality++
• Bigger team • New features
o Maven
o Androlog
o Jenkins
o Testing using
o Marvin
instrumentation tests
o Became really
o Apache Ant
complex
Copyright
©
2010
–
akquinet
AG
16
- 17. 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
Copyright
©
2010
–
akquinet
AG
17
- 18. 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
Copyright
©
2010
–
akquinet
AG
18
- 20. 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
Copyright
©
2010
–
akquinet
AG
20
- 21. 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);!
}!
- 22. 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);!
}!
- 23. From
a
bit
beMer
…
to
being
efficient
Version 2 Version 3 Version 4
• New features • Brandings • More brandings
• Bad ratings • Quality++ • Quality++
• Bigger team • New features • Socialization
o Maven
o Androlog
o Jenkins o Rindirect
o Testing using
o Marvin o Roboject
instrumentation tests
o Became really
o Apache Ant
complex
Copyright
©
2010
–
akquinet
AG
23
- 24. 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
Copyright
©
2010
–
akquinet
AG
24
- 25. 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
Copyright
©
2010
–
akquinet
AG
25
- 26. @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);!
}!
});!
}!
}!
- 27. From
a
bit
beMer
…
to
being
efficient
Version 2 Version 3 Version 4
• New features • Brandings • More brandings
• Bad ratings • Quality++ • Quality++
• Bigger team • New features • Socialization
o Maven
o Androlog
o Jenkins o Rindirect
o Testing using
o Marvin o Roboject
instrumentation tests
o Became really
o Apache Ant
complex
Copyright
©
2010
–
akquinet
AG
27
- 29. StAnD
ü Androlog
ü Maven-‐Android-‐Plugin
ü Jenkins
Plugin
ü Marvin
ü Rindirect
ü Roboject
ü Enterprise
Extensions
Copyright
©
2010
–
akquinet
AG
29
- 30. Q
&
A
Questions
?
hYp://stand.spree.de
Copyright
©
2010
–
akquinet
AG
30