mastering android development tools
TRANSCRIPT
W4 Session 4/15/2015 11:00 AM
"Mastering Android
Development Tools"
Presented by:
Luke Wallace
Bottle Rocket
Brought to you by:
340 Corporate Way, Suite 300, Orange Park, FL 32073 888-‐268-‐8770 ·∙ 904-‐278-‐0524 ·∙ [email protected] ·∙ www.sqe.com
Luke Wallace
Bottle Rocket Luke Wallace leads all Android development at Bottle Rocket. Luke wrote several of the first Android apps for Bottle Rocket and continues to oversee every project to maintain quality and push the bounds of what’s possible. A strong proponent of the Android platform, he is an invaluable resource for getting the Android perspective on news and trends within the industry. With his technical knowledge and humor, Luke loves educating people about Android.
4/8/15
2
Some of our Android Apps
Agenda
• Storing Code
• Writing Code
• Using Libraries
• Checking Code
• Building Code
• Testing Code
• Deploying Code
4/8/15
3
What’s the point?
BUT! Shakespeare Michelangelo
Use Good Tools
• Stuff You Know
• Eclipse
• Android Studio
• 9-Patch Generator
• Lint Rules
• Don’t use a typewriter to paint
4/8/15
4
Store code
• Bitbucket
• Cloud-based Git repository
• Team-based Access Control
• Cheap
Git branches
4/8/15
5
Git branches - git flow
origin/develop (progress builds)
origin/release/1.0
origin/release/1.1
[origin/]feature/x
Writing Code - Eclipse
• Traditional method of Android development
• Windows, Mac, and Linux support
• Lots of existing support
• XML layout support is okay, better than v1.0
• Old and Busted now
• No further development
• Dev site says to stop using it now!
4/8/15
6
Writing Code - Android Studio
• New Standard - reached 1.0 late 2014
• Still in heavy development
• Migration is getting easier
• We’re using it on new projects, and migrating old projects too it as time permits.
Checking Code - Lint
• Command Line tool
• Part of Android Developer Tools
• Lots of support from the Android team
• Our rule: No Warnings!
4/8/15
7
Custom Lint Rules
• Little Documentation
• Lots of setup (for the first one)
• Few examples (beyond the built in ones)
• android.googlesource.com/platform/sdk/[build]/lint/libs/lint_checks/src/
• Codify your internal rules
• Tip: 3-line Custom Manifest
Libraries
• Android Support Library
• ViewPager
• DrawerLayout
• ActionBarSherlock ActionBarCompat
• Square Libraries (OkHttp, Picasso, etc.)
• Ion, Volley, etc.
• Home Grown (BRShared)
4/8/15
8
Analyze
• Charles
• HTTP proxy - analyze requests & responses
• supports HTTPS with some additional effort
Analyze
• Hierarchy Viewer
4/8/15
9
One Weird Trick!
Add ViewServer to use Hierarchy Viewer on real devices!
Continuous Integration
• Jenkins
• Every 15 minutes (random per project)
• Check for new code
• Build (using Ant or gradle)
• DO IT!
4/8/15
10
Jenkins - Multiple Builds
• Debug
• Release
• Staging Servers
• Free
• Paid
• Amazon Appstore
• Google Play
Jenkins - Multiple Builds
• use your build.xml to change config URL or other parameters at build time.
<property environment="env"/><target name="preprocess-build-number" if="env.BUILD_NUMBER"> <echo>Setting build number: ${env.BUILD_NUMBER}</echo> <replaceregexp
file="res/values/build_config.xml" match="build_number">.*?<" replace="build_number">${env.BUILD_NUMBER}<"
/></target>
4/8/15
11
Jenkins - Multiple Builds
• use your build.xml to change config URL or other parameters at build time.
<target name="preprocess-release" if="build.target.release"> <echo>Configuring build_config.xml for a release build</echo> <replaceregexp
file="res/values/build_config.xml" match="version_name">.*?<" replace="version_name">@string/version_name_production<"/>
</target>
Jenkins - Multiple Builds
• Gradle build system makes this easier
4/8/15
12
Jenkins + Lint
Automated Testing
• We have it, barely
• JUnit + Android extensions
• AndroidTestCase
• monkeyrunner
• Robolectric
4/8/15
13
Real Devices
Automatic Crash Collection
ACRA - Application Crash Reporting for Android
• http://acra.ch
• Sends crashes to Google Docs
• Can send reports directly to your backend, or several hosted options.
4/8/15
14
Emulators
• Google Provided Emulator
• x86
• Genymotion - $$$ for commercial use
Google Play Dev Portal
Alpha - Beta - Production %
Get Optimization Tips
Analyze common devices
Respond to Reviews