【问题标题】:No resource found that matches the given name: attr ‘android:keyboardNavigationCluster’找不到与给定名称匹配的资源:attr ‘android:keyboardNavigationCluster’
【发布时间】:2018-03-21 01:37:54
【问题描述】:

我目前在尝试使用 ionic cordova run android --prod 时在我的 Ionic 项目中遇到了这个奇怪的错误。我试过删除和读取平台,删除和读取节点模块,以及切换 npm 和节点版本都无济于事。

问题:有人知道如何解决这个神秘问题吗?

C:\...\platforms\android\build\intermediates\res\merged\debug\values-v26\values-v26.xml:15: 

error: Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.

FAILED

BUILD FAILED

Total time: 26.595 secs

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\...\platforms\android\build\intermediates\res\merged\debug\values-v26\values-v26.xml:15:21-54: AAPT: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.

C:\...\platforms\android\build\intermediates\res\merged\debug\values-v26\values-v26.xml:15: error: Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.



FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

[ERROR] An error occurred while running cordova run android (exit code 1).
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

cli packages: (C:…\node_modules)

@ionic/cli-utils  : 1.12.0
ionic (Ionic CLI) : 3.12.0
global packages:

cordova (Cordova CLI) : 7.0.0
local packages:

@ionic/app-scripts : 3.0.0
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.7.1
System:

Android SDK Tools : 25.2.5
Node              : v6.11.4
npm               : 3.10.10
OS                : Windows 10
Misc:

backend : legacy

编辑:这里是我的科尔多瓦插件列表

    <plugin name="cordova-plugin-app-version" spec="^0.1.9" />
    <plugin name="cordova-plugin-camera" spec="^2.4.1">
    <plugin name="cordova-plugin-compat" spec="^1.2.0" />
    <plugin name="cordova-plugin-device" spec="^1.1.6" />
    <plugin name="cordova-plugin-file" spec="^4.3.3" />
    <plugin name="cordova-plugin-file-transfer" spec="^1.6.3" />
    <plugin name="cordova-plugin-filepath" spec="^1.1.0" />
    <plugin name="cordova-plugin-geolocation" spec="^2.4.3">
        <variable name="GEOLOCATION_USAGE_DESCRIPTION" value="To determine geolocation for clock in/out purposes." />
    </plugin>
    <plugin name="cordova-plugin-inappbrowser" spec="^1.7.1" />
    <plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
    <plugin name="cordova-plugin-statusbar" spec="^2.2.3" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.2" />
    <plugin name="cordova.plugins.diagnostic" spec="^3.6.8" />
    <engine name="android" spec="~6.2.3" />

【问题讨论】:

  • 能否请您添加您正在使用的cordova插件列表?
  • 完成@David,如果您需要任何其他信息来诊断问题,请告诉我。

标签: android node.js angular cordova ionic-framework


【解决方案1】:

这很可能与cordova 诊断插件有关。尝试安装版本3.7.1 应该可以解决问题:

cordova plugin add cordova.plugins.diagnostic@3.7.1

根本原因是 gradle 正在寻找它没有找到的 v26 资源。更详细的解释here

您可能还需要将 cordova-android 更新到版本 6.3.0 (cordova platform add android@6.3.0) 并升级到最新的 Android SDK 工具(通过 Android Studio)。这样做时不要忘记删除cordova-plugin-compat

【讨论】:

  • 我现在收到此错误任务':transformClassesWithDexForDebug'失败。 > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: 多个dex文件定义Lorg/apache/cordova /构建助手;错误:cmd:命令失败,退出代码为 1 错误输出:注意:某些输入文件使用或覆盖了已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以获取详细信息。注意:某些输入文件使用或覆盖已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以获取详细信息。
  • 您在使用 6.3.0 版本时必须删除 cordova-plugin-compat,因为它的代码现在包含在 cordova-android 中。 cordova plugin rm cordova-plugin-compat --force
  • 现在我遇到了这个问题 > ionic cordova prepare android > cordova prepare android 错误:找不到插件“cordova-plugin-compat”的 plugin.xml。请尝试重新添加。 [ERROR] 运行 cordova prepare android 时出错(退出代码 1)。
  • 如果有帮助,我可以发布我的 config.xml 和 package.json
  • 您必须删除 compat 插件的 all 引用。只需删除 config.xml 和 package.json 中的条目。您也可以尝试安装 1.2.0 版本的 cordova-plugin-compat(阅读插件 github 页面上的注释)。也许您的某个插件依赖于该插件。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-05-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-13
  • 1970-01-01
相关资源
最近更新 更多