import { Light as SyntaxHighlighter } from 'react-syntax-highlighter'; import hljsStyleGitHub from 'react-syntax-highlighter/dist/esm/styles/hljs/github'; import { ExtLink } from '../ExtLink'; import PowerShellAdbDumpCommandTemplate from './adb_dump.ps1?raw'; import ShellAdbDumpCommandTemplate from './adb_dump.sh?raw'; import { applyTemplate } from '~/util/applyTemplate'; export interface AdbInstructionTemplateProps { dir: string; file: string; platform: 'win32' | 'linux'; } const URL_USB_DEBUGGING = 'https://developer.android.com/studio/debug/dev-options?hl=zh-cn#Enable-debugging'; const LANGUAGE_MAP = { win32: { language: 'ps1', template: PowerShellAdbDumpCommandTemplate }, linux: { language: 'sh', template: ShellAdbDumpCommandTemplate }, }; export function AdbInstructionTemplate({ dir, file, platform }: AdbInstructionTemplateProps) { const { language, template } = LANGUAGE_MAP[platform]; const command = applyTemplate(template, { dir, file }); return (
确保 adb 命令可用。
粘贴执行下述代码执行。若设备提示「是否允许 USB 调试」或「超级用户请求」,选择允许:
adb connect ... 指令连接模拟器。详细请参考官方说明文档并调整上述脚本。
{file} 文件。