【问题标题】:Cordova build error on androidCordova在android上构建错误
【发布时间】:2018-11-07 04:32:10
【问题描述】:

我正在尝试构建和执行我的 cordova 项目,但我遇到了错误:

BUILD FAILED                                                                                                           
Total time: 5.696 secs FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not find common.jar (android.arch.core:common:1.1.0). Searched in the following locations:
      https://jcenter.bintray.com/android/arch/core/common/1.1.0/common-1.1.0.jar

* 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:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not find common.jar (android.arch.core:common:1.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/android/arch/core/common/1.1.0/common-1.1.0.jar

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

关键是同一个项目上周能够构建/运行,而今天不再工作了。 有人遇到过这个问题并找到了解决办法吗?

【问题讨论】:

  • 遇到了同样的问题。如果我删除 fcm 插件(ionic cordova plugin rm cordova-plugin-fcm)然后尝试构建,它可以工作。你也是这样吗?
  • 我实际上通过这个解决方案得到了它stackoverflow.com/questions/49839322/… 我编辑了文件 ..platforms\android\build.gradle 和 ..platforms\android\CordovaLib\build.gradle 并在其中我替换了mavenCentral();使用 maven { url "maven.google.com" } 然后我删除 fcm 插件并再次添加,然后我可以构建并运行。我不知道这是否是一个“好”的解决方案。
  • 我的项目中没有安装这个插件,但可能是我的一些插件导致了这个问题。我会试试这个解决方案,看看是否也对我有用。
  • 我认为该解决方案并没有特别绑定到 fcm 插件
  • 有效,但现在我遇到另一个错误:1-54:AAPT:找不到与给定名称匹配的资源:attr 'android:keyboardNavigationCluster'。有什么想法吗?

标签: android cordova ionic-framework jcenter


【解决方案1】:

打开platforms/android/然后build.gradle

在 jcenter() 之前添加 maven { url 'https://maven.google.com' }

allprojects
 {
    repositories {
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
}

google() 和 maven { url 'https://maven.google.com' } 指向同一个 repo,google() 是 Google 的 Maven repo 快捷方式。如果您正在使用,您可以添加 google() 而不是 maven { url 'https://maven.google.com' }:

Gradle >= v.4.x+

看来顺序很重要, 这对我有用

【讨论】:

    猜你喜欢
    • 2020-09-13
    • 2017-09-22
    • 1970-01-01
    • 2020-05-02
    • 2018-07-29
    • 2016-07-04
    • 2018-04-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多