2

I'm trying to build and execute my cordova project, but i'm facing the error:

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.

The point is that the same project was able to build/run last week, and today dont work anymore. Anyone had this problem and found some solution?

Gurbela
  • 1,184
  • 2
  • 16
  • 40
  • Got the same issue. If I remove the fcm plugin (ionic cordova plugin rm cordova-plugin-fcm) and then try to build, it works. Is it the same case for you? – Jörgen Lundgren May 28 '18 at 18:16
  • 1
    I actually got it working by this solution https://stackoverflow.com/questions/49839322/errorfailed-to-resolve-android-arch-corecommon1-1-0 I edited the files ..platforms\android\build.gradle and ..platforms\android\CordovaLib\build.gradle and in them I replaced the mavenCentral(); with maven { url "https://maven.google.com" } Then I remove fcm plugin and added again, and then i could build and run. I can't tell though if this is a "good" solution. – Jörgen Lundgren May 28 '18 at 19:13
  • I dont have this plugin intalled on my project, but maybe some of my plugins is causing that. i'll try this solution to see if will work to me too. – Evandro Weiss May 28 '18 at 19:40
  • I think that solution is not bound to the fcm plugin in particular – Jörgen Lundgren May 28 '18 at 19:41
  • Works, but now i'm having another error: 1-54: AAPT: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'. Any idea? – Evandro Weiss May 28 '18 at 20:06
  • I have the same problem with barcode scanner plugin - i'm using ionic framework – sijo vijayan May 29 '18 at 05:11

1 Answers1

0

Open platforms/android/ then build.gradle

Add maven { url 'https://maven.google.com' } before jcenter()

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

google() and maven { url 'https://maven.google.com' } are pointing to the same repo, google() is a Google's Maven repo shortcut. You can add google() instead of maven { url 'https://maven.google.com' } IF you are using :

Gradle >= v.4.x+

It seems the order matters, this works for me