debot android debugging library

26
Debot A simple debugging library Tomoaki Imai @ Roppongi.aar 09/30/2015

Upload: tomoaki-imai

Post on 05-Jan-2017

9.752 views

Category:

Engineering


7 download

TRANSCRIPT

Page 1: Debot android debugging library

Debot A simple debugging library

Tomoaki Imai @ Roppongi.aar 09/30/2015

Page 2: Debot android debugging library

twitter: @tomoaki_imai

github: tomoima525

Hi I’m TomoAndroid Engineer at Mercari, Inc.

Page 3: Debot android debugging library

Debugging in Android

Page 4: Debot android debugging library

Things developers do for debugging

• Visualise an apps data

• Activity, intent, logs etc.

• Visualise ( numerous kinds of )devices’ data

• Screen density, OS ver, memory etc.

• Check the behaviour of apps

Page 5: Debot android debugging library

What bothers developers when debugging?

Page 6: Debot android debugging library

Unnecessary code for Production

…but you need them for debugging :-(

Page 7: Debot android debugging library

Wasting time reproducing same behaviour

• Input texts

• Change settings

• Access Api

Page 8: Debot android debugging library

Way to check app & device info are limited

• Check from Setting

• Write some codes ( but you need them rarely )

Page 9: Debot android debugging library

Tired of wasting your time debugging?

Page 10: Debot android debugging library

DebotA simple Android Library to support

your debugging

https://github.com/tomoima525/debot

Page 11: Debot android debugging library

Debot offers you productive debugging features

1. Has useful debugging features by default

2. Hassle-free implementation

3. Customisable Plugins

4. Able to call specific methods from Activity

Page 12: Debot android debugging library

1. Debugging features

Page 13: Debot android debugging library

Debugging features

• Default Debugging menu

• check dpi

• show intent

• check App ver

• dev input

Page 14: Debot android debugging library

Debugging features• Visualise app and device info

Page 15: Debot android debugging library

Debugging features

• Auto Input

@DebotAnnotation("debugInput") public void debugInput() { EditText editText = (EditText) findViewById(R.id.input_1); editText.setText("This is sample!");}

Page 16: Debot android debugging library

2. Hassle-free Implementation

Page 17: Debot android debugging library

Implementation

dependencies { compileDebug 'com.tomoima.debot:debot:1.0.1' compileRelease ‘com.tomoima.debot:debot-no-op:1.0.1’}

build.gradle

Page 18: Debot android debugging library

Implementation

public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); DebotConfigurator.configureWithDefault(this); }}

Application.java

Page 19: Debot android debugging library

Implementationpublic class MainActivity extends AppCompatActivity{ @Override public boolean onCreateOptionsMenu(Menu menu) { Debot.onCreateOptionsMenu(menu); return super.onCreateOptionsMenu(menu); }

@Override public boolean onOptionsItemSelected(MenuItem item) { Debot.onOptionsItemSelected(item); return super.onOptionsItemSelected(item); }

@Override protected void onResume() { super.onResume(); Debot.onResume(this); }

@Override protected void onPause() { super.onPause(); Debot.onPause(this); }}

Page 20: Debot android debugging library

3. Customisable Plugins

Page 21: Debot android debugging library

Customisable Plugins

public class MyDebotStrategy extends DebotStrategy{ @Override public void startAction(@NonNull Activity activity) { // Do your things }}

Page 22: Debot android debugging library

Customisable Plugins

public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); DebotStrategyBuilder builder = new DebotStrategyBuilder.Builder(context) .registerMenu("My feature", new MyDebotStrategy()) .build();

DebotConfigurator. configureWithCustomizeMenu(this, builder.getStrategyList()); }}

Page 23: Debot android debugging library

4. Call methods from Activity

Page 24: Debot android debugging library

Call methods from Activity

@DebotAnnotation(“callApiForDebug")public void callApiForDebug() { Api.call(this, params);}

@DebotAnnotation(“startActivityForDebug")public void startActivityForDebug() { Intent intent = NextActivity.createIntent(this, params); startActivity(intent);}

MyActivity.java

Page 25: Debot android debugging library

Call methods from Activity

public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); DebotStrategyBuilder builder = new DebotStrategyBuilder.Builder(context) .registerMenu(“call api", new DebotCallActivityMethodStrategy(“callApiForDebug”)) .registerMenu(“start activity", new DebotCallActivityMethodStrategy(“startActivityForDebug")) .build();

DebotConfigurator .configureWithCustomizeMenu(this, builder.getStrategyList()); }}

Page 26: Debot android debugging library

Happy debugging with Debot!

https://github.com/tomoima525/debotSource code and sample are available at Github