From 2c8675bd220222fad332f13fe99ca1530ceafc60 Mon Sep 17 00:00:00 2001 From: Soitora Date: Tue, 9 Jan 2024 01:44:36 +0100 Subject: [PATCH] Add extension creation guide --- .../.vitepress/config/navigation/sidebar.ts | 18 + .../guides/creating-extensions/compiling.md | 134 ++++++++ .../creating-extensions/prerequisites.md | 126 +++++++ .../guides/creating-extensions/writing.md | 310 ++++++++++++++++++ 4 files changed, 588 insertions(+) create mode 100644 website/src/docs/guides/creating-extensions/compiling.md create mode 100644 website/src/docs/guides/creating-extensions/prerequisites.md create mode 100644 website/src/docs/guides/creating-extensions/writing.md diff --git a/website/src/.vitepress/config/navigation/sidebar.ts b/website/src/.vitepress/config/navigation/sidebar.ts index 3821a4a8..0340750c 100644 --- a/website/src/.vitepress/config/navigation/sidebar.ts +++ b/website/src/.vitepress/config/navigation/sidebar.ts @@ -96,6 +96,24 @@ function defaultSidebar(): DefaultTheme.SidebarItem[] { }, ], }, + { + text: 'Creating extensions', + collapsed: true, + items: [ + { + text: 'Prerequisites', + link: '/docs/guides/creating-extensions/prerequisites', + }, + { + text: 'Writing an extension', + link: '/docs/guides/creating-extensions/writing', + }, + { + text: 'Compiling and running', + link: '/docs/guides/creating-extensions/compiling', + }, + ], + }, { text: 'Source migration', link: '/docs/guides/source-migration', diff --git a/website/src/docs/guides/creating-extensions/compiling.md b/website/src/docs/guides/creating-extensions/compiling.md new file mode 100644 index 00000000..f31d275c --- /dev/null +++ b/website/src/docs/guides/creating-extensions/compiling.md @@ -0,0 +1,134 @@ +--- +title: Compiling and running +titleTemplate: Creating extensions - Guides +description: Compile and run own Tachiyomi extension. +--- + +# Compiling and running + +## Running + +To make local development more convenient, you can use the following run configuration to launch **Tachiyomi** directly at the Browse panel: + +![](https://i.imgur.com/STy0UFY.png) + +If you're running a Preview or debug build of **Tachiyomi**: + +```bash +-W -S -n eu.kanade.tachiyomi.debug/eu.kanade.tachiyomi.ui.main.MainActivity -a eu.kanade.tachiyomi.SHOW_CATALOGUES +``` + +And for a release build of **Tachiyomi**: + +```bash +-W -S -n eu.kanade.tachiyomi/eu.kanade.tachiyomi.ui.main.MainActivity -a eu.kanade.tachiyomi.SHOW_CATALOGUES +``` +::: warning IMPORTANT +If you're deploying to Android 11 or higher, enable the "Always install with package manager" option in the run configurations. +Without this option enabled, you might face issues such as **Android Studio** running an older version of the extension without the modifications you might have done. +::: + +## Debugging + +### Android Debugger + +You can leverage the **Android Debugger** to step through your extension while debugging. + +You *cannot* simply use **Android Studio**'s `Debug 'module.name'` -> this will most likely result in an error while launching. + +Instead, once you've built and installed your extension on the target device, use `Attach Debugger to Android Process` to start debugging **Tachiyomi**. + +![](https://i.imgur.com/muhXyfu.png) + +### Logs + +You can also elect to simply rely on logs printed from your extension, which +show up in the [`Logcat`](https://developer.android.com/studio/debug/am-logcat) panel of **Android Studio**. + +### Inspecting network calls + +One of the easiest way to inspect network issues (such as HTTP errors 404, 429, no chapter found etc.) is to use the [`Logcat`](https://developer.android.com/studio/debug/am-logcat) panel of **Android Studio** and filtering by the `OkHttpClient` tag. + +To be able to check the calls done by OkHttp, you need to enable verbose logging in the app, that is not enabled by default and is only included in the Preview versions of **Tachiyomi**. To enable it, go to