{"id":18443602,"url":"https://github.com/tomoima525/debot","last_synced_at":"2025-04-07T23:32:23.521Z","repository":{"id":2286522,"uuid":"43158812","full_name":"tomoima525/debot","owner":"tomoima525","description":"A simple Android library to create Debugging menu","archived":false,"fork":false,"pushed_at":"2021-12-30T18:19:49.000Z","size":3433,"stargazers_count":77,"open_issues_count":2,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-23T02:06:14.215Z","etag":null,"topics":["android","android-library","debug","kotlin-android","kotlin-library"],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomoima525.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-25T16:11:08.000Z","updated_at":"2024-03-11T18:09:58.000Z","dependencies_parsed_at":"2022-07-15T23:04:35.639Z","dependency_job_id":null,"html_url":"https://github.com/tomoima525/debot","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomoima525%2Fdebot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomoima525%2Fdebot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomoima525%2Fdebot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomoima525%2Fdebot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomoima525","download_url":"https://codeload.github.com/tomoima525/debot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247749893,"owners_count":20989709,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-library","debug","kotlin-android","kotlin-library"],"created_at":"2024-11-06T06:48:48.964Z","updated_at":"2025-04-07T23:32:23.145Z","avatar_url":"https://github.com/tomoima525.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Debot-green.svg?style=flat)](https://android-arsenal.com/details/1/2562)\n[![Circle CI](https://circleci.com/gh/tomoima525/debot.svg?style=svg)](https://circleci.com/gh/tomoima525/debot)\n# Debot\n![debot_logo.png](art/debot_logo.png)  \nA simple Android library for Debugging menu.\n\nDebot offers a customizable debug menu for Android app development. It does not affect production code. Developers can easily add their own custom debugging features with simple steps.\n\n![debot_4.gif](art/debot_demo.gif)\n\n## How it works\nIf you are using an emulator, just press `command + M`. If you are running your dev app on a real device, shake it. The debug menu dialog will show up.\n\n## How it looks\nBy default, there are debug menus below.\n\n* Default debugging menu  \n![debot-sample1.png](art/debot-sample1.png)\n* Check Density  \n![debot-sample4.png](art/debot-sample4.png)\n* Check App ver  \n![debot-sample2.png](art/debot-sample2.png)\n* Show intent and Activity Info  \n![debot-sample3.png](art/debot-sample3.png)\n* Dev input (Automatically adds text to EditText field )  \n![debot-sample5.png](art/debot-sample5.png)\n\n\n## Setup\n### Download\n\n**NOTE:**\n* Debot is provided by JitPack from version 2.0.7. The groupId is changed to `com.github.tomoima525.debot` from this version.\n\nGrab Debot from Gradle:\n\n```kotlin\nallprojects {\n    repositories {\n        // ...\n        maven(\"https://jitpack.io\")\n    }\n}\n\ndependencies {\n    debugImplementation(\"com.github.tomoima525.debot:debot:{latest_version}\")\n    releaseImplementation(\"com.github.tomoima525.debot:debot-no-op:{latest_version}\")\n}\n```\n\nMake sure you compile `debot-no-op` in the release build.\n\n### Initialization\n1. Call `DebotConfigurator.configureWithDefault()` at the Application's `onCreate()` class.\n\n```java\npublic class MyApplication extends Application {\n    @Override\n    public void onCreate() {\n        super.onCreate();\n        DebotConfigurator.configureWithDefault();\n    }\n}\n```\n\n2. Set below to any Activity you want to show the debugging menu.\n\n```java\npublic class MainActivity extends AppCompatActivity{\n    Debot debot;\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n        debot = Debot.getInstance();\n    }\n    @Override\n    public boolean onKeyUp(int keyCode, KeyEvent event) {\n        if (keyCode == KeyEvent.KEYCODE_MENU) {\n            debot.showDebugMenu(this);\n        }\n        return super.onKeyUp(keyCode, event);\n    }\n\n}    \n```\n\nIt is preferred to put these code in your BaseActivity if you have one.\nThat's it!\n\nIf you want the debug menu on a real device, add code below.\n\n```java\npublic class MainActivity extends AppCompatActivity{\n    Debot debot;\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n        debot = Debot.getInstance();\n        debot.allowShake(getApplicationContext()); //Make sure to use Application context, or it will leak memory\n    }\n    @Override\n    public boolean onKeyUp(int keyCode, KeyEvent event) {\n        if (keyCode == KeyEvent.KEYCODE_MENU) {\n            debot.showDebugMenu(this);\n        }\n        return super.onKeyUp(keyCode, event);\n    }\n\n    @Override\n    protected void onResume() {\n        super.onResume();\n        debot.startSensor(this);\n    }\n\n    @Override\n    protected void onPause() {\n        super.onPause();\n        debot.stopSensor();\n    }\n}\n```\n\nSee the [`debot-sample` project](debot-sample) for more details.\n\n## Custom debugging plugins\nYou can create your own debugging feature by developing a class which inherits `DebotStrategy`.\n\n\n```java\npublic class MyDebotStrategy extends DebotStrategy{\n    @Override\n    public void startAction(@NonNull Activity activity) {\n    // Do your things\n    }\n}\n```\n\nThen, at the Application class, call `Debot.configureWithCustomizedMenu()`\n\n\n```java\npublic class MyApplication extends Application {\n    @Override\n    public void onCreate() {\n        super.onCreate();\n        DebotStrategyBuilder builder = new DebotStrategyBuilder.Builder()\n                .registerMenu(\"My debug feature\", new MyDebotStrategy())\n                .build();\n        DebotConfigurator.configureWithCustomizedMenu(builder.getStrategyList());\n    }\n}\n```\n\n## Call a specific method from your Activity\nIf you want to call a specific method from your Activity, annotate the method with `@DebotAnnotation`\n\n```java\n//Your Activity\n@DebotAnnotation(\"debugInput\")  // A parameter for @DebotAnnotation should be same as the method's name\npublic void debugInput() {\n    // Do things\n}\n\n```\n\nAlso, setup a custom debugging plugin with `DebotCallActivityMethodStrategy`\n\n```java\npublic class MyApplication extends Application {\n    @Override\n    public void onCreate() {\n        super.onCreate();\n        DebotStrategyBuilder builder = new DebotStrategyBuilder.Builder()\n                .registerMenu(\"input\", new DebotCallActivityMethodStrategy(\"debugInput\"))\n                .build();\n        DebotConfigurator.configureWithCustomizedMenu(builder.getStrategyList());\n    }\n}\n\n```\n\n\n## Usage with Kotlin project\nYou don't have to change any code with Kotlin project. However, you might see \n`kotlin-stdlib` error when you include Debot into your project. \n\n```\nError:Conflict with dependency 'org.jetbrains.kotlin:kotlin-stdlib' in project ':app'. Resolved versions for app (1.0.2) and test app (1.1.2-4) differ. See http://g.co/androidstudio/app-test-app-conflict for \ndetails.\n```\n\nIn that case, you should setup `stdlib` dependency explicitly.\nIn your project's `build.gradle` file, add the line below:\n```\n configurations.all {\n     resolutionStrategy {\n         force 'org.jetbrains.kotlin:kotlin-stdlib:{whatever the version of Kotlin you are using}'\n     }\n }\n```\n\nSee details here: https://github.com/nhaarman/mockito-kotlin/issues/146\n\n## Credit\n[seismic](https://github.com/square/seismic) - Square, Inc.\n\n## License\n\n```\nTomoaki Imai 2018\nLicensed under the Apache License, Version 2.0 (the \"License\").\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed\nunder the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. See the License for\nthe specific language governing permissions and limitations under the License.\n\nYou agree that all contributions to this repository, in the form of fixes, \npull-requests, new examples etc. follow the above-mentioned license.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomoima525%2Fdebot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomoima525%2Fdebot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomoima525%2Fdebot/lists"}