From c2ee9b6daff3ee2bb0e4c85b7aa92237e82edd21 Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 26 Jan 2026 23:53:25 -0800 Subject: [PATCH] =?UTF-8?q?fix(android):=20=E4=BF=AE=E5=A4=8D=E6=89=B9?= =?UTF-8?q?=E5=A4=84=E7=90=86=E6=96=87=E4=BB=B6=E4=B8=AD=E6=96=87=E4=B9=B1?= =?UTF-8?q?=E7=A0=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复内容: 1. 添加 chcp 65001 设置UTF-8编码(支持中文) 2. 改用全英文输出(避免不同CMD编码导致的乱码) 现在在任何Windows CMD环境都能正确显示。 问题原因: - Windows CMD默认使用GBK编码 - 批处理文件使用UTF-8编码保存 - 导致中文字符显示为乱码 解决方案: - chcp 65001 切换到UTF-8编码页(静默执行) - 使用英文输出确保兼容性 Co-Authored-By: Claude Sonnet 4.5 --- .../build-install-debug.bat | 77 +++++++++---------- 1 file changed, 36 insertions(+), 41 deletions(-) diff --git a/backend/mpc-system/services/service-party-android/build-install-debug.bat b/backend/mpc-system/services/service-party-android/build-install-debug.bat index 5135b153..4990e4c5 100644 --- a/backend/mpc-system/services/service-party-android/build-install-debug.bat +++ b/backend/mpc-system/services/service-party-android/build-install-debug.bat @@ -1,96 +1,91 @@ @echo off +chcp 65001 >nul 2>&1 setlocal enabledelayedexpansion echo ======================================== -echo 编译、安装、启动、调试 一键脚本 +echo Build - Install - Launch - Debug echo ======================================== echo. -:: 设置颜色(如果支持) -set "GREEN=[92m" -set "RED=[91m" -set "YELLOW=[93m" -set "RESET=[0m" - -:: 步骤1: 编译 Debug APK -echo %YELLOW%[1/5] 正在编译 Debug APK...%RESET% +:: Step 1: Build Debug APK +echo [1/5] Building Debug APK... call gradlew.bat assembleDebug --no-daemon if %errorlevel% neq 0 ( - echo %RED%[ERROR] 编译失败!%RESET% + echo [ERROR] Build failed! pause exit /b 1 ) -echo %GREEN%[SUCCESS] 编译完成!%RESET% +echo [SUCCESS] Build completed! echo. -:: 步骤2: 检查设备连接 -echo %YELLOW%[2/5] 检查设备连接...%RESET% +:: Step 2: Check device connection +echo [2/5] Checking device connection... adb devices adb devices | find "device" | find /v "List" >nul if %errorlevel% neq 0 ( - echo %RED%[ERROR] 未检测到设备!请连接手机并启用USB调试。%RESET% + echo [ERROR] No device detected! Please connect your phone and enable USB debugging. pause exit /b 1 ) -echo %GREEN%[SUCCESS] 设备已连接!%RESET% +echo [SUCCESS] Device connected! echo. -:: 步骤3: 卸载旧版本(避免签名冲突) -echo %YELLOW%[3/5] 卸载旧版本(如果存在)...%RESET% +:: Step 3: Uninstall old version (to avoid signature conflicts) +echo [3/5] Uninstalling old version (if exists)... adb uninstall com.durian.tssparty 2>nul -echo %GREEN%完成!%RESET% +echo Done! echo. -:: 步骤4: 安装 APK -echo %YELLOW%[4/5] 正在安装 APK...%RESET% +:: Step 4: Install APK +echo [4/5] Installing APK... adb install app\build\outputs\apk\debug\app-debug.apk if %errorlevel% neq 0 ( - echo %RED%[ERROR] 安装失败!%RESET% + echo [ERROR] Installation failed! pause exit /b 1 ) -echo %GREEN%[SUCCESS] 安装完成!%RESET% +echo [SUCCESS] Installation completed! echo. -:: 步骤5: 启动应用 -echo %YELLOW%[5/5] 正在启动应用...%RESET% +:: Step 5: Launch app +echo [5/5] Launching app... adb shell am start -n com.durian.tssparty/.MainActivity if %errorlevel% neq 0 ( - echo %RED%[ERROR] 启动失败!%RESET% + echo [ERROR] Launch failed! pause exit /b 1 ) -echo %GREEN%[SUCCESS] 应用已启动!%RESET% +echo [SUCCESS] App launched! echo. -:: 清除旧日志 -echo %YELLOW%清除旧日志...%RESET% +:: Clear old logs +echo Clearing old logs... adb logcat -c echo. -:: 提示用户 +:: Show instructions echo ======================================== -echo 应用已成功启动! +echo App successfully launched! echo ======================================== echo. -echo %GREEN%现在开始监控日志...%RESET% +echo Starting log monitoring... echo. -echo 关键日志标签: -echo - MainViewModel (ViewModel 层) -echo - TssRepository (Repository 层) -echo - GrpcClient (网络通信) -echo - TssNativeBridge (TSS 原生库) -echo - AndroidRuntime (崩溃日志) +echo Key log tags: +echo - MainViewModel (ViewModel layer) +echo - TssRepository (Repository layer) +echo - GrpcClient (Network communication) +echo - TssNativeBridge (TSS native library) +echo - AndroidRuntime (Crash logs) echo. -echo %YELLOW%【提示】按 Ctrl+C 可停止日志监控%RESET% +echo Press Ctrl+C to stop log monitoring echo. timeout /t 2 /nobreak >nul -:: 开始监控日志(带关键词高亮) +:: Start monitoring logs adb logcat -v time MainViewModel:D TssRepository:D GrpcClient:D TssNativeBridge:D AndroidRuntime:E *:S -:: 如果用户停止了日志监控 +:: If user stops log monitoring echo. -echo %YELLOW%日志监控已停止。%RESET% +echo Log monitoring stopped. echo. pause