xinli/xinli-App/查找APK.bat
2025-11-23 10:19:32 +08:00

80 lines
1.9 KiB
Batchfile
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.

@echo off
chcp 65001 >nul
setlocal enabledelayedexpansion
echo ========================================
echo 查找APK文件
echo ========================================
echo.
REM 获取当前脚本所在目录的绝对路径
set "PROJECT_DIR=%~dp0"
set "PROJECT_DIR=%PROJECT_DIR:~0,-1%"
echo 正在搜索APK文件...
echo.
set "FOUND=0"
REM 检查Debug版本
set "DEBUG_APK=%PROJECT_DIR%\app\build\outputs\apk\debug\app-debug.apk"
if exist "!DEBUG_APK!" (
echo [找到] Debug版本APK:
echo 绝对路径: !DEBUG_APK!
for %%A in ("!DEBUG_APK!") do (
echo 文件大小: %%~zA 字节
echo 修改时间: %%~tA
)
echo.
set "FOUND=1"
) else (
echo [未找到] Debug版本APK
echo 预期位置: !DEBUG_APK!
echo.
)
REM 检查Release版本
set "RELEASE_APK=%PROJECT_DIR%\app\build\outputs\apk\release\app-release.apk"
if exist "!RELEASE_APK!" (
echo [找到] Release版本APK:
echo 绝对路径: !RELEASE_APK!
for %%A in ("!RELEASE_APK!") do (
echo 文件大小: %%~zA 字节
echo 修改时间: %%~tA
)
echo.
set "FOUND=1"
) else (
echo [未找到] Release版本APK
echo 预期位置: !RELEASE_APK!
echo.
)
if !FOUND!==0 (
echo ========================================
echo 未找到任何APK文件
echo.
echo 可能的原因:
echo 1. 还没有执行过打包操作
echo 2. 打包失败,请检查错误信息
echo 3. APK文件在其他位置
echo.
echo 建议:运行 build-apk.bat 进行打包
echo ========================================
) else (
echo ========================================
echo 是否打开APK所在文件夹(Y/N)
set /p openFolder=
if /i "!openFolder!"=="Y" (
if exist "!DEBUG_APK!" (
explorer /select,"!DEBUG_APK!"
) else if exist "!RELEASE_APK!" (
explorer /select,"!RELEASE_APK!"
)
)
)
echo.
pause