You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Pipeline中android-manifest-version@1任务报“Unable to find matched key”求助

解决Azure Pipeline android-manifest-version@1任务报错“Unable to find matched key”

可能原因及修复步骤

  • 检查AndroidManifest.xml核心结构
    确保AndroidManifest.xml的<manifest>标签中存在android:versionCode属性(任务需要匹配到该属性才能完成修改),正确结构示例:

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.your.app.package"
        android:versionCode="1"
        android:versionName="1.0.0">
        <!-- 其他内容 -->
    </manifest>
    

    如果原本没有android:versionCode,先手动添加初始值,任务才能识别并替换。

  • 验证Manifest文件路径正确性
    任务配置的sourcePath可能指向错误位置,添加前置脚本验证文件是否存在:

    - script: |
        ls -la $(Build.SourcesDirectory)/android/app/src/main/AndroidManifest.xml
      displayName: 'Verify Manifest File Exists'
    

    查看Pipeline日志,确认文件确实存在于该路径下,若路径错误则修正sourcePath。

  • 调整任务参数配置
    若不需要修改versionName,直接移除versionName:这一行(留空可能导致任务尝试匹配该属性却找不到),修改后的任务配置示例:

    - task: android-manifest-version@1
      inputs:
        sourcePath: '$(Build.SourcesDirectory)/android/app/src/main/AndroidManifest.xml'
        versionCodeOption: 'buildid'
        versionCode: '$(Build.BuildId)'
        versionCodeOffset: '1'
        printFile: true
    
  • 确认命名空间正确性
    确保<manifest>标签顶部声明了xmlns:android="http://schemas.android.com/apk/res/android",否则android:versionCode会被视为无效属性,任务无法匹配。

内容的提问来源于stack exchange,提问作者Kapil G

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 17:44:56