跳过内容

额外资源

解决常见问题:使用 Capgo Cloud Build 构建原生应用时的故障排除。

”Upload failed” or “Connection timeout”

Section titled “”Upload failed” or “Connection timeout””

Section titled “ 。。””

  • 症状:
  • 项目上传时构建失败

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. 一些依赖项可能在构建过程中下载大文件

    • Section titled “”Build timeout after 10 minutes””
    • 考虑使用锁文件进行预缓存
  3. 查看本机依赖项

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

    • 如果您的应用程序合法地需要更多时间
    • 我们可以根据具体用例调整限制

身份验证问题

身份验证问题

”API key invalid” or “Unauthorized”

API

key无效”或“未授权””

  • 构建立即失败,出现认证错误
  • 401 或 403 错误

解决方案:

  1. 验证API密钥是否正确

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

    • 密钥必须具有 writeall 检查__CAPGO_KEEP_0__密钥权限
    • 检查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

”App not found” or “No permission for this app”

Section titled “”App not found” or “No permission for this app””

Symptoms:

  • Authentication works but app-specific error

Solutions:

  1. Verify app is registered

    Terminal window
    bunx @capgo/cli@latest app list
  2. 检查应用 ID 是否匹配

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

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

iOS 构建问题

iOS 构建问题

问题:

  • 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 中创建新的
    • 重新编码并更新环境变量

”Provisioning profile doesn’t include signing certificate”

Section titled “”Provisioning profile doesn’t include signing certificate””

Symptoms:

  • Xcode can’t find certificate in profile

Solutions:

  1. 解决方案:下载最新的配置文件

    • 前往 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 Developer 门户中编辑配置文件
    • 确保已选择您的发布证书
    • 下载并重新编码

App Store Connect 身份验证失败

App Store Connect 身份验证失败

问题:

  • 向 TestFlight 发布失败
  • API 键错误

解决方案:

  1. 验证API键凭证

    • 检查 APPLE_KEY_ID(应为 10 个字符)
    • 检查 APPLE_ISSUER_ID(应为 UUID 格式)
    • 验证 APPLE_KEY_CONTENT 是否正确 base64 编码
  2. 同步计算机时钟

    • App Store Connect 认证使用从本地系统时间生成的短期 JWT
    • Apple 拒绝过期时间超过 20 分钟的令牌,因此即使是微小的时钟漂移也会使一个原本有效的密钥失败
    • 在 Windows 上打开 设置 > 时区和语言 > 日期和时间 然后点击 立即同步
    • 在 macOS 上,打开 系统设置 > 常规 > 日期和时间 并启用自动时间同步
    • 在 Linux 上,检查 timedatectl status 并如果需要启用 NTP
    • 同步后重新运行 Capgo 构建或凭据命令

    参见 Apple 的 为 API 请求生成令牌的文档 了解 App Store Connect 令牌生命周期规则

  3. 测试 API 本地密钥

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

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

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

“Pod 安装失败”

标题:“Pod 安装失败”

症状:

  • 构建在 CocoaPods 安装期间失败
  • Podfile 错误

解决方案:

  1. 验证 Podfile.lock 已提交

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

    终端窗口
    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

安卓构建问题

安卓构建问题

症状:

  • 签名过程中构建失败
  • Gradle 错误关于密钥库

解决方案:

  1. 验证密钥库密码

    终端窗口
    # 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

Symptoms:

  • Signing fails with alias error

解决方案:

  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 build failed”

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

Symptoms:

  • Build succeeds but upload fails
  • Service account errors

Solutions:

  1. Verify service account JSON

    Terminal window
    # Decode and check format
    echo $PLAY_CONFIG_JSON | base64 -d | jq .
  2. 检查服务帐户权限

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

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

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

”Job not found” or “Build status unavailable”

Section titled “”

症状:

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

解决方案:

  1. 稍等一下,重新尝试

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

    • 从初始构建响应中验证作业 ID
  3. 检查构建是否过期

    • 24 小时内可用

Symptoms:

  • Build fails before compilation starts
  • Missing files errors

Solutions:

  1. Run Capacitor sync locally

    Terminal window
    bunx cap sync
  2. Ensure all native files are committed

    Terminal window
    git status ios/ android/
  3. 检查被忽略的本机文件

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

“我成功构建了项目,但无法看到输出”

标题:“我成功构建了项目,但无法看到输出”

症状:

  • 构建显示成功但无下载链接

解决方案:

  1. 检查构建配置

    • 可能的存储位置未配置
    • 如果您的构建无法访问存储位置,请联系支持
  2. iOS测试飞行提交

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

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

CI/CD特定问题

CI/CD特定问题

症状:

  • bunx @capgo/cli@latest … CI中出现“命令未找到”错误

解决方案:

  1. 首先设置 Bun 所以 bunx 可用:

    - uses: oven-sh/setup-bun@v2
  2. 然后运行 CLIbunx 它在需要时动态获取,不需要全局安装:

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

GitHub 动作: “找不到密钥”

标题为 “GitHub 动作: “找不到密钥””

症状:

  • 构建环境变量为空

解决方案:

  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上会排队以确保最佳使用
  • 构建工件下载可用性取决于构建目的地和工件存储配置
  • 这些限制可能会根据反馈进行调整。

预扫描阻止了我的构建

预扫描阻止了我的构建

已知限制

Capgo 运行本地 预扫描 上传之前,预扫描会运行。修复报告的发现,或者忽略该检查 id:

终端窗口
npx @capgo/cli@latest build request <appId> --platform ios \
--prescan-skip ios/capacitor-server-url-shipped

查看完整目录: 预扫描检查.