Debot android debugging library

Post on 05-Jan-2017

9.752 views 7 download

Transcript of Debot android debugging library

Debot A simple debugging library

Tomoaki Imai @ Roppongi.aar 09/30/2015

twitter: @tomoaki_imai

github: tomoima525

Hi I’m TomoAndroid Engineer at Mercari, Inc.

Debugging in Android

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

What bothers developers when debugging?

Unnecessary code for Production

…but you need them for debugging :-(

Wasting time reproducing same behaviour

• Input texts

• Change settings

• Access Api

Way to check app & device info are limited

• Check from Setting

• Write some codes ( but you need them rarely )

Tired of wasting your time debugging?

DebotA simple Android Library to support

your debugging

https://github.com/tomoima525/debot

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

1. Debugging features

Debugging features

• Default Debugging menu

• check dpi

• show intent

• check App ver

• dev input

Debugging features• Visualise app and device info

Debugging features

• Auto Input

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

2. Hassle-free Implementation

Implementation

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

build.gradle

Implementation

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

Application.java

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); }}

3. Customisable Plugins

Customisable Plugins

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

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()); }}

4. Call methods from Activity

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

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()); }}

Happy debugging with Debot!

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