Files
workphone-sdk/sdk/scripts/run_app.sh

53 lines
1.4 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 快速运行工作手机Agent APP
echo "=== 工作手机Agent - 快速启动 ==="
echo ""
# 检查设备
echo "1. 检查设备连接..."
DEVICES=$(adb devices | grep -v "List" | grep "device$" | wc -l | tr -d ' ')
if [ "$DEVICES" -eq 0 ]; then
echo "❌ 未发现设备"
echo ""
echo "请先启动设备:"
echo " - Android Studio → Device Manager → 启动模拟器"
echo " - 或连接真机开启USB调试"
echo ""
read -p "按回车键重试或Ctrl+C退出..."
exec "$0"
fi
echo "✅ 发现设备:"
adb devices | grep "device$"
echo ""
# 检查APK
APK_PATH="android-app/app/build/outputs/apk/debug/app-debug.apk"
if [ ! -f "$APK_PATH" ]; then
echo "❌ APK未找到: $APK_PATH"
echo "请先编译APP: cd android-app && ./gradlew assembleDebug"
exit 1
fi
echo "2. 安装APP..."
adb install -r "$APK_PATH" || {
echo "安装失败,尝试卸载后重装..."
adb uninstall com.workphone.agent 2>/dev/null
adb install "$APK_PATH"
}
echo ""
echo "3. 启动APP..."
adb shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n com.workphone.agent/.MainActivity
echo ""
echo "✅ APP已启动"
echo ""
echo "使用说明:"
echo " - 点击蓝色麦克风按钮说'打开豆包'"
echo " - 或点击底部'打开豆包'快捷按钮"
echo " - 点击右上角设置图标配置服务器(可选)"
echo ""