SlideShare una empresa de Scribd logo
1 de 76
Descargar para leer sin conexión
#mobilization2016
THE 2016 ANDROID
DEVELOPER TOOLBOX
@Nilhcem
#mobilization2016
THE 2016 ANDROID
DEVELOPER TOOLBOX
"Use the right tools for the right job"
(with the Android Plugin for Gradle)
BUILD VARIANTS
U+2020
https://github.com/JakeWharton/u2020
DEBUG SCREEN
Example from Google iosched
INTERNAL SETTINGS APP
Similar to U+2020 Sample app
Display build / device information
Change endpoint (restart process with
)
Show logs ( )
Allow easy bug report capturing
( )
Enable/Disable Takt / Stetho / Scalpel /
Madge...
JakeWharton/ProcessPhoenix
pedrovgs/Lynx
mattprecious/telescope
MOBILIZATION 2016 APPLICATION
https://github.com/Nilhcem/mobilization-2016
MEASURING TOOLS
ANDROID STUDIO
(Android Monitor tab)
DETECT MEMORY LEAKS
LEAK CANARY
https://github.com/square/leakcanary
FRAME RATE
build.gradle:
MyApplication.java:
https://github.com/wasabeef/Takt
compile 'jp.wasabeef:takt:1.0.3'
public class MyApplication extends Application {
@Override public void onCreate() {
super.onCreate();
Takt.stock(this).play();
}
}
HUGO
https://github.com/JakeWharton/hugo
Prefix classes/methods with:
@DebugLog
Result:
MobilizationApp V ⇢ onCreate()
V ⇢ initGraph()
V ⇠ initGraph [13ms]
V ⇢ initLogger()
V ⇠ initLogger [1ms]
V ⇠ onCreate [73ms]
PIDCAT
https://github.com/JakeWharton/pidcat
$ pidcat com.nilhcem.mobilization
ANDROIDDEVMETRICS
build.gradle:
MyApplication.java:
https://github.com/frogermcs/AndroidDevMetrics
apply plugin: 'com.frogermcs.androiddevmetrics'
public class MyApplication extends Application {
@Override public void onCreate() {
super.onCreate();
AndroidDevMetrics.initWith(this);
}
}
CODE STATIC ANALYSIS TOOLS
Lint
Error Prone (Google)
Infer (Facebook)
SONARQUBE
Dockerfile:
FROM java:8
MAINTAINER Nilhcem
RUN DEBIAN_FRONTEND=noninteractive apt update
RUN DEBIAN_FRONTEND=noninteractive apt install -y wget unzip
RUN wget -q https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-6.1.zip
RUN unzip -qq sonarqube-6.1.zip -d /opt/
RUN rm sonarqube-6.1.zip
EXPOSE 9000
CMD ["/opt/sonarqube-6.1/bin/linux-x86-64/sonar.sh", "console"]
Then launch:
$ docker build -t nilhcem/sonarqube .
$ docker run -p 9000:9000 -d nilhcem/sonarqube
SONARQUBE GRADLE CONFIGURATION
build.gradle:
apply plugin: 'org.sonarqube'
sonarqube {
properties {
def appProject = project(':app')
def appProjectBuildDir = appProject.buildDir
property 'sonar.projectKey', 'mobilization'
property 'sonar.projectName', 'Mobilization 2016'
property 'sonar.projectVersion', appProject.android.defaultConfig.versionName
property 'sonar.host.url', 'http://localhost:9000'
property 'sonar.sources', 'src'
property 'sonar.sourceEncoding', 'UTF-8'
property 'sonar.java.binaries', 'build/intermediates/classes/production/debug'
property 'sonar.java.test.binaries', 'build/intermediates/classes/test/production/debug'
property 'sonar.exclusions', 'src/test/java/**'
property 'sonar.core.codeCoveragePlugin', 'jacoco'
property 'sonar.jacoco.reportPath', "$appProjectBuildDir/jacoco/testProductionDebugUnitTest.exec"
property 'sonar.junit.reportsPath', "$appProjectBuildDir/test-results/testProductionDebugUnitTest/productionDebug"
}
}
Then launch:
./gradlew :app:assembleProductionDebug :app:testProductionDebugUnitTest :app:sonarqube
TESTING TOOLS
MOCK SERVER
NODEJS + EXPRESS
/* Setup */
var fs = require('fs');
var express = require('express');
var app = express();
app.set('port', process.env.PORT || 8080);
var port = app.get('port');
/* Speakers list */
app.get('/speakers', function(req, res) {
res.type('application/json; charset=utf8');
res.status(200).send(fs.readFileSync('data/speakers.json', 'utf8'));
});
/* Other web services */
// ...
/* Starting the server */
app.listen(port, function () {
console.log('Express server listening on port ' + port);
});
NODEJS + EXPRESS
Slow service
sleep(2000);
function sleep(durationMillis) {
var now = new Date().getTime();
while (new Date().getTime() < now + durationMillis) {
// do nothing
}
}
// Please do not take pictures of this slide,
// This is not something I am proud of
EXAMPLE
Then, go to:
https://github.com/Nilhcem/mobilization-2016
/tree/master/mockserver
$ npm install
$ npm start
http://localhost:8990/
HOSTS EDITOR
https://play.google.com/store/apps/details?id=com.nilhcem.hostseditor
HTTP DEBUGGING
HTTP DEBUGGING
mitmproxy
Fiddler
Charles proxy
CHARLES PROXY
Simulate a slow connection
Repeat queries
Check the responses
Add some breakpoints to:
Cancel an HTTP(s) call
Edit a request
Edit a response
ANDROID STATE
RESTORING
DON'T KEEP ACTIVITIES
FILL RAM
https://play.google.com/store/apps/details?id=com.tspoon.androidtoolbelt
ANDROID DEVICE MONITOR - STOP PROCESS
ANALYZING TOOLS
DEVELOPER OPTIONS
UIAUTOMATORVIEWER
ANIMATIONS
Developer options -> Animation scale
ANIMATIONS
Make a screencast (API 19+):
VLC :
$ adb shell screenrecord /sdcard/demo.mp4
$ adb pull /sdcard/demo.mp4
Press the keyboard 'E' key to see
frames one by one
APKTOOL + DEX2JAR + JD-GUI
http://ibotpeaches.github.io/Apktool
https://github.com/pxb1988/dex2jar
http://jd.benow.ca
JADX
https://github.com/skylot/jadx
ANDROID STUDIO
(Build > Analyze APK)
STETHO
STETHO - UI
STETHO - NETWORK
STETHO
DUMPAPP
STETHO - DUMPAPP
SOME MORE DUMPAPP EXAMPLES
$ dumpapp accessToken invalidate
$ dumpapp accessToken show
fce1235425dcdeadbeef8cafebabe42
$ dumpapp clipboard get
Hello
$ dumpapp clipboard set "Text to copy"
$ dumpapp onTrimMemory
$ dumpapp openIntent scheme://open/speaker/3
$ dumpapp gcmToken
uHyMKnEQ:APA91bEHZ6afFLQQMzKgSDjp5y_0397usitPqj_Bp02
$ dumpapp geolocData
Location[fused 22.5430883,114.1043205 acc=21 et=+21m5s492ms]
$ dumpapp runningServices
com.example.LocationService
STETHO - CUSTOM PLUGIN
http://code.tutsplus.com/tutorials/debugging-android-apps-with-facebooks-stetho--cms-24205
class AppDumperPlugin implements DumperPlugin {
@Override
public String getName() {
return "my_plugin_name";
}
@Override
public void dump(DumperContext dumpContext) throws DumpException {
PrintStream writer = dumperContext.getStdout();
String commandName = (args.isEmpty()) ? "" : args.remove(0);
if (commandName.equals("test")) {
out.println("Hello, World!");
}
}
}
STETHO - CUSTOM PLUGIN
STETHO - DUMPAPP (EXAMPLE)
(ActivityProvider in a dependency graph in debug)
@Singleton
public class ActivityProvider implements Application.ActivityLifecycleCallbacks {
private Activity currentActivity;
@Inject
public ActivityProvider(Application app) {
app.registerActivityLifecycleCallbacks(this);
}
public Activity getCurrentActivity() {
return currentActivity;
}
@Override
public void onActivityResumed(Activity activity) {
currentActivity = activity;
}
@Override
public void onActivityPaused(Activity activity) {
currentActivity = null;
}
}
STETHO - DUMPAPP (EXAMPLE)
AppDumperPlugin.java
private void displayCurrentSessionData(PrintStream writer) {
Activity activity = activityProvider.getCurrentActivity();
if (activity instanceof SessionDetailsActivity) {
try {
// Use reflection to access private "session" field
Field field = SessionDetailsActivity.class.getDeclaredField("session");
field.setAccessible(true);
Session session = (Session) field.get(activity);
writer.println(new GsonBuilder().setPrettyPrinting().create().toJson(session));
} catch (Exception e) {
writer.println(e.getMessage());
}
}
}
$#*!,
I FORGOT THESE TOOLS!
ADB + SHELL
# Open a deep linking intent
adb shell am start -a android.intent.action.VIEW -d "scheme://app/deep/linking"
# List running services
adb shell dumpsys activity services
# Get the path of an install application
adb shell pm path app.package.name
# Clear app data
adb shell pm clean app.package.name
# Take a screenshot
adb shell screencap -p | perl -pe '''s/x0Dx0A/x0A/g''' > screen.png
# Paste text from your computer clipboard to your android device
pbpaste | sed "s/%/%%/g" | sed "s/ /%s/g" | xargs adb shell input text
POSTMAN
https://www.getpostman.com/
LOCKITO
https://play.google.com/store/apps/details?id=fr.dvilleneuve.lockito
ACCESSIBILITY SCANNER
https://play.google.com/store/apps/details?id=com.google.android.apps.accessibility.auditor
VYSOR
http://www.vysor.io
AS A CONCLUSION...
CHOOSE ACCORDING
TO YOUR NEEDS AND
TASTES
THE 2016 ANDROID
DEVELOPER TOOLBOX
(EXAMPLE OF AN)
ANDROID DEVELOPER
TOOLBOX
https://twitter.com/Nilhcem
https://github.com/Nilhcem/mobilization-2016
http://www.slideshare.net/Nilhcem/the-2016-android-developer-toolbox-mobilization
MASTER YOUR TOOLS
TO BUILD BETTER APPS

Más contenido relacionado

La actualidad más candente

Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
Yekmer Simsek
 
2011 py con
2011 py con2011 py con
2011 py con
Eing Ong
 
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефона
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефонаКурсы по мобильной разработке под iOS. 4 лекция. Возможности телефона
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефона
Глеб Тарасов
 

La actualidad más candente (19)

package org dev
package org devpackage org dev
package org dev
 
Android Design Patterns
Android Design PatternsAndroid Design Patterns
Android Design Patterns
 
More android code puzzles
More android code puzzlesMore android code puzzles
More android code puzzles
 
Enhance your world with ARKit. UA Mobile 2017.
Enhance your world with ARKit. UA Mobile 2017.Enhance your world with ARKit. UA Mobile 2017.
Enhance your world with ARKit. UA Mobile 2017.
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
 
Android TDD
Android TDDAndroid TDD
Android TDD
 
Capture image on eye blink
Capture image on eye blinkCapture image on eye blink
Capture image on eye blink
 
303 TANSTAAFL: Using Open Source iPhone UI Code
303 TANSTAAFL: Using Open Source iPhone UI Code303 TANSTAAFL: Using Open Source iPhone UI Code
303 TANSTAAFL: Using Open Source iPhone UI Code
 
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
 
2011 py con
2011 py con2011 py con
2011 py con
 
Gdg san diego android 11 meetups what's new in android - ui and dev tools
Gdg san diego android 11 meetups  what's new in android  - ui and dev toolsGdg san diego android 11 meetups  what's new in android  - ui and dev tools
Gdg san diego android 11 meetups what's new in android - ui and dev tools
 
Blending Culture in Twitter Client
Blending Culture in Twitter ClientBlending Culture in Twitter Client
Blending Culture in Twitter Client
 
Androidaop 170105090257
Androidaop 170105090257Androidaop 170105090257
Androidaop 170105090257
 
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефона
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефонаКурсы по мобильной разработке под iOS. 4 лекция. Возможности телефона
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефона
 
mobl
moblmobl
mobl
 
Android Unit Testing With Robolectric
Android Unit Testing With RobolectricAndroid Unit Testing With Robolectric
Android Unit Testing With Robolectric
 
멀티플랫폼 앱 개발과 테스팅
멀티플랫폼 앱 개발과 테스팅멀티플랫폼 앱 개발과 테스팅
멀티플랫폼 앱 개발과 테스팅
 
TDD per Webapps
TDD per WebappsTDD per Webapps
TDD per Webapps
 
Vlad Nedomovniy "Navigation with less pain"
Vlad Nedomovniy "Navigation with less pain"Vlad Nedomovniy "Navigation with less pain"
Vlad Nedomovniy "Navigation with less pain"
 

Similar a The 2016 Android Developer Toolbox [MOBILIZATION]

Introducing Applitude: Simple Module Management
Introducing Applitude: Simple Module ManagementIntroducing Applitude: Simple Module Management
Introducing Applitude: Simple Module Management
Eric Hamilton
 
JavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the PlatformJavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the Platform
Robert Nyman
 
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NCAndroid Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Jim Tochterman
 
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W... 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Robert Nyman
 
The Open Web and what it means
The Open Web and what it meansThe Open Web and what it means
The Open Web and what it means
Robert Nyman
 

Similar a The 2016 Android Developer Toolbox [MOBILIZATION] (20)

Arquitecturas de microservicios - Medianet Software
Arquitecturas de microservicios   -  Medianet SoftwareArquitecturas de microservicios   -  Medianet Software
Arquitecturas de microservicios - Medianet Software
 
Introducing Applitude: Simple Module Management
Introducing Applitude: Simple Module ManagementIntroducing Applitude: Simple Module Management
Introducing Applitude: Simple Module Management
 
Android best practices
Android best practicesAndroid best practices
Android best practices
 
JavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the PlatformJavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the Platform
 
Non Conventional Android Programming (English)
Non Conventional Android Programming (English)Non Conventional Android Programming (English)
Non Conventional Android Programming (English)
 
Non Conventional Android Programming En
Non Conventional Android Programming EnNon Conventional Android Programming En
Non Conventional Android Programming En
 
Dropwizard and Friends
Dropwizard and FriendsDropwizard and Friends
Dropwizard and Friends
 
scope or not?
scope or not?scope or not?
scope or not?
 
Mobile App Development: Primi passi con NativeScript e Angular 2
Mobile App Development: Primi passi con NativeScript e Angular 2Mobile App Development: Primi passi con NativeScript e Angular 2
Mobile App Development: Primi passi con NativeScript e Angular 2
 
Dojo and Adobe AIR
Dojo and Adobe AIRDojo and Adobe AIR
Dojo and Adobe AIR
 
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NCAndroid Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
 
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W... 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
README.MD for building the first purely digital mobile bank in Indonesia
README.MD for building the first purely digital mobile bank in Indonesia README.MD for building the first purely digital mobile bank in Indonesia
README.MD for building the first purely digital mobile bank in Indonesia
 
The Open Web and what it means
The Open Web and what it meansThe Open Web and what it means
The Open Web and what it means
 
DWR, Hibernate and Dojo.E - A Tutorial
DWR, Hibernate and Dojo.E - A TutorialDWR, Hibernate and Dojo.E - A Tutorial
DWR, Hibernate and Dojo.E - A Tutorial
 
@Ionic native/google-maps
@Ionic native/google-maps@Ionic native/google-maps
@Ionic native/google-maps
 
A gently introduction to AngularJS
A gently introduction to AngularJSA gently introduction to AngularJS
A gently introduction to AngularJS
 
Amplify를 통해 클라우드 기반 모바일 앱 개발하기 - 박태성(IDEASAM) :: AWS Community Day 2020
Amplify를 통해 클라우드 기반 모바일 앱 개발하기 - 박태성(IDEASAM) :: AWS Community Day 2020Amplify를 통해 클라우드 기반 모바일 앱 개발하기 - 박태성(IDEASAM) :: AWS Community Day 2020
Amplify를 통해 클라우드 기반 모바일 앱 개발하기 - 박태성(IDEASAM) :: AWS Community Day 2020
 
Spring boot
Spring boot Spring boot
Spring boot
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 

The 2016 Android Developer Toolbox [MOBILIZATION]