【问题标题】:Cordova AndroidManifest.xml Doesn't Exist w/ 7.0 Plugin CompatibilityCordova AndroidManifest.xml 不存在与 7.0 插件兼容性
【发布时间】:2018-06-20 19:04:00
【问题描述】:

安装插件或仅将 7.0/7.1 Android 平台添加到 Cordova 项目时,系统将返回错误 failed to install 'plugin name': Error: ENOENT: no such file or directory, open '...application directory.../platforms/android/AndroidManifest.xml'尽管插件从不引用旧文件位置。

根据 Cordova 博客文章 here,该插件已将其编辑配置 AndroidManifest.xml 目标切换为 app/src/main/AndroidManifest.xml,但它仍然会导致错误。

【问题讨论】:

    标签: android cordova


    【解决方案1】:

    解决方案是将任何对根res 目录的引用移动到app/src/main/res 以及AndroidManifest.xml

    例如,如果您在应用程序主 config.xml 文件中有引用,例如

    <resource-file src="resources/android/notification-icon.png" 
        target="res/drawable/notification_icon.png" />
    

    然后target 需要更改为看起来像

    <resource-file src="resources/android/notification-icon.png" 
        target="app/src/main/res/drawable/notification_icon.png" />
    

    为了在cordova-android@7.0.0 或以上工作。

    对于大多数人来说,同样的问题最有可能的答案在这里: Cordova does not create AndroidManifest.xml 然而,这个答案是我项目中唯一能解决问题的方法。

    这一发现归功于@ryanwilliams 对@jcesarmobile 对上面链接问题的回答的评论,并强调了这一点

    如果您的项目根目录中有一个“res”文件夹,即使在更新 plugin.xml 中的路径后,您仍然会收到此错误(由于 Eclipse 项目检测)

    【讨论】:

      猜你喜欢
      • 2018-03-18
      • 2021-03-03
      • 1970-01-01
      • 1970-01-01
      • 2018-05-13
      • 2015-12-16
      • 1970-01-01
      • 2017-05-29
      • 1970-01-01
      相关资源
      最近更新 更多