跳过内容

故障排除

解决在使用 Capgo Cloud Build 构建原生应用时遇到的常见问题。

“上传失败”或“连接超时”

标题:“上传失败”或“连接超时”

症状:

  • 项目上传过程中构建失败
  • 超时错误在 60 秒后出现

解决方案:

  1. 检查您的互联网连接

    终端窗口
    # Test connection to Capgo
    curl -I https://api.capgo.app
  2. 减少项目大小

    • 确保 node_modules/ 正在上传(应自动排除)
    • 检查项目中的大文件:
    终端窗口
    find . -type f -size +10M
  3. 检查上传 URL 是否过期

    • 上传 URL 将在 1 小时后过期
    • 如果您收到过期 URL 错误,请重新运行构建命令

“构建超时 10 分钟”

标题:“构建超时 10 分钟”

症状:

  • 构建超时
  • 状态显示 timeout

解决方案:

  1. 优化依赖项

    • 移除未使用的npm包
    • 使用 npm prune --production 在构建之前
  2. 在构建过程中检查网络问题

    • 某些依赖项可能在构建过程中下载大文件
    • 考虑使用锁文件进行预缓存
  3. 检查本机依赖项

    终端窗口
    # iOS - check Podfile for heavy dependencies
    cat ios/App/Podfile
    # Android - check build.gradle
    cat android/app/build.gradle
  4. 联系支持

    • If your app needs more time, please contact us
    • We can adjust limits for specific use cases

认证问题

认证问题

“API key invalid” or “Unauthorized”

“API key invalid” or “Unauthorized”

症状:

  • 构建过程中出现认证错误
  • 401 或 403 错误

解决方案:

  1. 检查API key是否正确

    终端窗口
    # Test with a simple command
    bunx @capgo/cli@latest app list
  2. 检查API密钥权限

    • __CAPGO_KEEP_0__密钥必须具有 writeall 权限
    • 在Capgo控制台下API密钥
  3. 确保API密钥正在被读取

    终端窗口
    # Check environment variable
    echo $CAPGO_TOKEN
    # Or check your saved credentials file
    cat ~/.capgo-credentials/credentials.json # global
    cat .capgo-credentials.json # local (--local)
  4. 重新验证

    终端窗口
    bunx @capgo/cli@latest login

”应用未找到”或“无此应用的权限”

应用未找到或无此应用的权限

症状:

  • 认证正常,但应用特定错误

解决方案:

  1. 验证应用已注册

    终端窗口
    bunx @capgo/cli@latest app list
  2. 检查应用 ID 是否匹配

    • 验证 capacitor.config.json 应用 ID
    • 确保命令使用正确的应用 ID
  3. 验证组织访问

    • 检查您是否在正确的组织中
    • API 必须具有对应用程序组织的访问权限

iOS 构建问题

iOS 构建问题

Code 签名失败

Code 签名失败

症状:

  • 构建过程中code签名阶段失败
  • Xcode 错误关于证书或配置文件

解决方案:

  1. 验证证书类型与构建类型匹配

    • 开发构建需要开发证书
    • App Store 构建需要分发证书
  2. 检查证书和配置文件匹配

    终端窗口
    # Decode and inspect your certificate
    echo $BUILD_CERTIFICATE_BASE64 | base64 -d > cert.p12
    openssl pkcs12 -in cert.p12 -nokeys -passin pass:$P12_PASSWORD | openssl x509 -noout -subject
  3. 确保配置文件有效

    • 检查过期日期
    • 验证它包含您的 App ID
    • 确认它包含证书
  4. 重新生成凭据

    • 删除旧的证书/配置文件
    • 在 Apple Developer portal 中创建新的
    • 重新编码和更新环境变量

“签名证书未包含在配置文件中”

标题:“签名证书未包含在配置文件中”

症状:

  • Xcode无法在配置文件中找到证书

解决方案:

  1. 从Apple下载最新配置文件

    • 前往Apple Developer → 证书、ID和配置文件
    • 下载配置文件
    • 确保配置文件包含您的证书
  2. 验证证书是否包含在配置文件中

    终端窗口
    # Extract profile
    echo $BUILD_PROVISION_PROFILE_BASE64 | base64 -d > profile.mobileprovision
    # View profile contents
    security cms -D -i profile.mobileprovision
  3. 重建使用正确证书的配置文件

    • 在 Apple 开发者门户中编辑配置文件
    • 确保已选择您的发布证书
    • 下载并重新编码

”App Store Connect authentication failed”

Section titled “”App Store Connect authentication failed””

症状:

  • 上传到 TestFlight 失败
  • API 键错误

解决方案:

  1. 验证 API 键凭证

    • 检查 APPLE_KEY_ID(应为 10 位数字)
    • 检查 APPLE_ISSUER_ID(应为 UUID 格式)
    • 验证 APPLE_KEY_CONTENT 是否正确 base64 编码
  2. 测试 API 本地密钥

    终端窗口
    # Decode key
    echo $APPLE_KEY_CONTENT | base64 -d > AuthKey.p8
    # Test with fastlane (if installed)
    fastlane pilot list
  3. 检查 API 密钥权限

    • 密钥需要 “开发者”角色或更高
    • 在 App Store Connect → 用户和访问 → 密钥中验证
  4. 确保密钥未被撤销

    • 在 App Store Connect 中检查
    • 如果需要,请生成新密钥

症状:

  • 在 CocoaPods 安装过程中构建失败
  • Podfile 错误

解决方案:

  1. 验证 Podfile.lock 是否已提交

    终端窗口
    git status ios/App/Podfile.lock
  2. 在本地测试 pod 安装

    终端窗口
    cd ios/App
    pod install
  3. 检查不兼容的 Pods

    • 检查 Podfile 中的版本冲突
    • 确保所有 Pods 支持您的 iOS 部署目标
  4. 清除 Pod 缓存

    终端窗口
    cd ios/App
    rm -rf Pods
    rm Podfile.lock
    pod install
    # Then commit new Podfile.lock

Android 构建问题

Android 构建问题

存储库密码错误

存储库密码错误

症状:

  • 签名过程中构建失败
  • Gradle错误关于keystore

解决方案:

  1. 验证keystore密码

    终端窗口
    # Test keystore locally
    keytool -list -keystore my-release-key.keystore
    # Enter password when prompted
  2. 检查环境变量

    终端窗口
    # Ensure no extra spaces or special characters
    echo "$KEYSTORE_STORE_PASSWORD" | cat -A
    echo "$KEYSTORE_KEY_PASSWORD" | cat -A
  3. 验证base64编码

    终端窗口
    # Decode and test
    echo $ANDROID_KEYSTORE_FILE | base64 -d > test.keystore
    keytool -list -keystore test.keystore

症状:

  • 使用别名错误导致签名失败

解决方案:

  1. 列出密钥库别名

    终端窗口
    keytool -list -keystore my-release-key.keystore
  2. 确认别名完全匹配

    • 别名区分大小写
    • 检查KEYSTORE_KEY_ALIAS中是否有拼写错误
  3. 使用密钥库中的正确别名

    终端窗口
    # Update environment variable to match
    export KEYSTORE_KEY_ALIAS="the-exact-alias-name"

”Gradle构建失败”

Gradle构建失败”标题

症状:

  • 常规Gradle错误
  • 编译或依赖问题

解决方案:

  1. 先在本地测试构建

    终端窗口
    cd android
    ./gradlew clean
    ./gradlew assembleRelease
  2. 检查缺失的依赖项

    • 检查build.gradle文件
    • 确保所有插件都列在依赖项中
  3. 验证Gradle版本兼容性

    终端窗口
    # Check gradle version
    cat android/gradle/wrapper/gradle-wrapper.properties
  4. 清除Gradle缓存

    终端窗口
    cd android
    ./gradlew clean
    rm -rf .gradle build

”Play Store上传失败”

标题:”Play Store上传失败”

症状:

  • 构建成功但上传失败
  • 服务帐户错误

解决方案:

  1. 验证服务账户 JSON

    终端窗口
    # Decode and check format
    echo $PLAY_CONFIG_JSON | base64 -d | jq .
  2. 检查服务账户权限

    • 前往 Google Play 控制台 → 设置 → API 访问
    • 确保服务账户有权访问您的应用
    • 授予“发布到测试渠道”权限
  3. 验证应用已在 Google Play 控制台设置

    • 应用必须先在 Google Play 控制台创建
    • 至少需要手动上传一个 APK
  4. 检查 API 是否已启用

    • Google Play Developer API 必须启用
    • Google Cloud Console 中检查

"任务未找到"或"构建状态不可用"

标题:"任务未找到"或"构建状态不可用"

症状:

  • 无法检查构建状态
  • 任务 ID 错误

解决方案:

  1. 等待一会儿并重试

    • 构建作业可能需要几秒钟才能初始化
  2. 检查工作 ID 是否正确

    • 从初始构建响应中验证工作 ID
  3. 检查构建未过期

    • 构建数据在 24 小时内可用

“项目同步失败”

标题:“项目同步失败”

症状:

  • 构建在编译开始之前失败
  • 缺失文件错误

解决方案:

  1. 在本地运行 Capacitor 同步

    终端窗口
    bunx cap sync
  2. 确保所有本地文件都已提交

    终端窗口
    git status ios/ android/
  3. 检查被忽略的本地文件

    • 查看 .gitignore
    • 确保重要的配置文件不被忽略

”Build succeeded but I don’t see output”

Section titled “”Build succeeded but I don’t see output””

Symptoms:

  • Build shows success but no download link

Solutions:

  1. 检查构建配置

    • 可能未配置的存储
    • 如果构建中无法访问存储,请联系支持
  2. 用于 iOS TestFlight 提交

    • 检查 App Store Connect
    • 上传后处理可能需要 5-30 分钟
  3. 用于 Android Play Store

    • 检查 Play Console → Testing → Internal testing
    • 处理可能需要几分钟

CI/CD 特定问题

CI/CD 特定问题

问题描述:

  • bunx @capgo/cli@latest … 在 CI 中执行时会出现 “command not found” 的错误

解决方案:

  1. 首先确保安装了 Bun 然后 bunx 可复制到剪贴板

    - uses: oven-sh/setup-bun@v2
  2. Then run the CLIbunx 可复制到剪贴板

    - run: bunx @capgo/cli@latest build request com.example.app --platform android

症状:

  • 构建环境变量为空

解决方案:

  1. 验证密钥是否已设置

    • 前往仓库设置 → 秘密和变量 → 动作
    • 添加所有必需的密钥
  2. 使用正确的语法

    env:
    CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}
  3. 检查密钥名称是否匹配

    • 名称区分大小写
    • 密钥引用中无错误

获取更多帮助

获取更多帮助

启用详细日志

启用详细日志
终端窗口
# Add debug flag (when available)
bunx @capgo/cli@latest build request com.example.app --verbose

收集构建信息

收集构建信息

联系支持时,请包含:

  1. 构建命令

    终端窗口
    bunx @capgo/cli@latest build request com.example.app --platform ios
  2. 错误信息 (全输出)

  3. 作业 ID (从构建输出)

  4. 构建日志 (复制全终端输出)

  5. 环境信息

    终端窗口
    node --version
    npm --version
    bunx @capgo/cli@latest --version

当前限制:

  • 最大构建时间:10分钟
  • 最大上传大小:约500MB
  • iOS构建需要24小时的Mac租赁,构建在Mac上会排队以确保最佳使用
  • 构建工件下载可用性取决于构建目的地和工件存储配置

根据反馈调整这些限制。