{"id":13804790,"url":"https://github.com/AlexTrotsenko/j2v8-debugger","last_synced_at":"2025-05-13T18:32:51.391Z","repository":{"id":45242009,"uuid":"150746428","full_name":"AlexTrotsenko/j2v8-debugger","owner":"AlexTrotsenko","description":"This project is an add-on for the excellent J2V8 Project.  It allows users to debug JS running in V8 using Chrome DevTools.  Uses Stetho for communication with Chrome DevTools.","archived":false,"fork":false,"pushed_at":"2024-02-07T12:52:31.000Z","size":297,"stargazers_count":88,"open_issues_count":6,"forks_count":24,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-18T21:46:40.624Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/AlexTrotsenko.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-09-28T13:41:20.000Z","updated_at":"2024-09-20T01:44:21.000Z","dependencies_parsed_at":"2024-02-07T13:54:28.940Z","dependency_job_id":null,"html_url":"https://github.com/AlexTrotsenko/j2v8-debugger","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexTrotsenko%2Fj2v8-debugger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexTrotsenko%2Fj2v8-debugger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexTrotsenko%2Fj2v8-debugger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexTrotsenko%2Fj2v8-debugger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexTrotsenko","download_url":"https://codeload.github.com/AlexTrotsenko/j2v8-debugger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254003452,"owners_count":21997889,"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":[],"created_at":"2024-08-04T01:00:53.962Z","updated_at":"2025-05-13T18:32:51.378Z","avatar_url":"https://github.com/AlexTrotsenko.png","language":"Kotlin","funding_links":[],"categories":["Using DevTools frontend with other platforms"],"sub_categories":["Browser Adapters"],"readme":"# J2V8-Debugger\n\nThis project is an add-on for the excellent [J2V8 Project](https://github.com/eclipsesource/J2V8).\n\nIt allows users to debug JS running in V8 using [Chrome DevTools](https://developers.google.com/web/tools/chrome-devtools/).\n\nUses [Stetho](https://github.com/facebook/stetho) for communication with Chrome DevTools.\n\n## Features\n* Debugging embedded V8 in Android app using Chrome DevTools.\n* Support setting/removing breakpoints, step into, step out and step over, variables inspection, etc.\n* Debugging embedded V8 is similar to [Remote Debugging WebViews](https://developers.google.com/web/tools/chrome-devtools/remote-debugging/webviews).\n* Access debuggable V8 in the app via **chrome://inspect**.\n\n## SetUp\nAdd JitPack repository in your root build.gradle at the end of repositories:\n\n```gradle\nallprojects {\n    repositories {\n        maven { url \"https://jitpack.io\" }\n    }\n}\n```\n\nAdd dependency in *gradle.build* file of your app module\n```gradle\ndependencies {\n    implementation ('com.github.AlexTrotsenko:j2v8-debugger:0.2.4') // {\n    //     optionally J2V8 can be excluded if specific version of j2v8 is needed or defined by other libs\n    //     exclude group: 'com.eclipsesource.j2v8'\n    // }\n}\n```\n\n**Note:** current `j2v8-debugger` version is designed for `J2V8` version _6.1+_.\n\nUse [0.1.2](https://github.com/AlexTrotsenko/j2v8-debugger/tree/0.1.2) when debugging of older J2V8 _(4.6.0+)_ is required.  \n\n## Usage\n\n`StethoHelper` and `V8Debugger` are used for set-up of Chrome DevTools and V8 for debugging.\n\n1. Initialization Stetho in `Application` class.\n\n```.Kotlin\n    StethoHelper.initializeDebugger(context, scriptSourceProvider)\n```\n\n2. Creation of debuggable V8 instance.\n\nUse `V8Debugger.createDebuggableV8Runtime()` instead of `V8.createV8Runtime()`\n\n```.Kotlin\n    val debuggableV8Runtime : Future\u003cV8\u003e = V8Debugger.createDebuggableV8Runtime(v8Executor, globalAlias, enableLogging)\n```\n\nSee [sample project](https://github.com/AlexTrotsenko/j2v8-debugger/blob/master/j2v8-debugger-sample/src/main/java/com/alexii/j2v8debugging/sample/ExampleActivity.kt) for more info.\n\n### Notes regarding J2V8 threads.\n- Creation and clean-up of V8 should run on fixed V8 thread.\n- Creation and clean-up of V8 Debugger should run on fixed V8 thread.\n- Debugging operation like set/remove breakpoint should run on fixed V8 thread.\n- Execution of any JS script/function should run on fixed V8 thread.\n\nIt's easier to implement such behaviour _(especially from lib point of view)_ if single-threaded V8 executor is used.\n\nThis way all above mentioned operations would run on such executor.\n\nTherefore lib api like `V8Debugger.createDebuggableV8Runtime(v8Executor)` is build with this concept in mind.\n\nLater v8 executor will be passed to Chrome DevTools and used for performing debug-related operations.\n\nIf Guava is already used in project - MoreExecutors and [ListenableFuture](https://github.com/google/guava/wiki/ListenableFutureExplained) could be handy.\n\n### License\n\n```\nCopyright 2015 Alexii Trotsenko\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAlexTrotsenko%2Fj2v8-debugger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAlexTrotsenko%2Fj2v8-debugger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAlexTrotsenko%2Fj2v8-debugger/lists"}