Cordova-plugin-firebase: Build fails, could not resolve all files for configuration ':app:debugCompileClasspath'

Created on 28 Jun 2018  ·  12Comments  ·  Source: arnesson/cordova-plugin-firebase

After installing firebase plugin I'm getting this build error. Cordova CLI 8, android platforms tested: 7.1.0, 7.0.0, 6.4.0. After removing firebase plugin build succeeds. Below is terminal log of a test project, but same behavior noticed in pre-existing apps that were working in fact earlier today. I tried adding and changing things in build.gradle buildscript repositories and allprojects repositories but to no avail. TIA

zcoffin@DESKTOP-PUBHRS2 MINGW64 ~/Documents/switchboard (master)
$ cordova create firebasetest
Creating a new cordova project.

zcoffin@DESKTOP-PUBHRS2 MINGW64 ~/Documents/switchboard (master)
$ cd firebasetest

zcoffin@DESKTOP-PUBHRS2 MINGW64 ~/Documents/switchboard/firebasetest (master)
$ cordova plugin add cordova-plugin-firebase
Adding cordova-plugin-firebase to package.json
Saved plugin info for "cordova-plugin-firebase" to config.xml

zcoffin@DESKTOP-PUBHRS2 MINGW64 ~/Documents/switchboard/firebasetest (master)
$ cordova platform add [email protected]
Using cordova-fetch for [email protected]
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: io.cordova.hellocordova
Name: HelloCordova
Activity: MainActivity
Android target: android-27
Subproject Path: CordovaLib
Subproject Path: app
Android project created with [email protected]
Android Studio project detected
Android Studio project detected
Installing "cordova-plugin-firebase" for android
Subproject Path: CordovaLib
Subproject Path: app
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project
Installing "cordova-plugin-whitelist" for android

           This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.

Adding cordova-plugin-whitelist to package.json
Saved plugin info for "cordova-plugin-whitelist" to config.xml
Preparing Firebase on Android
--save flag or autosave detected
Saving android@~7.1.0 into config.xml file ...

zcoffin@DESKTOP-PUBHRS2 MINGW64 ~/Documents/switchboard/firebasetest (master)
$ cordova run android
Android Studio project detected
Preparing Firebase on Android
ANDROID_HOME=C:\Users\zcoffin\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_144
studio
:wrapper

BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_9xxnqqha5bkaipei78uv1fe7e.run(C:\Users\zcoffin\Documents\switchboard\firebasetest\platforms\android\app\build.gradle:144)
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugAidl
:CordovaLib:compileDebugRenderscript
:CordovaLib:checkDebugManifest
:CordovaLib:generateDebugBuildConfig
:CordovaLib:prepareLintJar
:CordovaLib:generateDebugResValues
:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources
:CordovaLib:platformAttrExtractor
:CordovaLib:processDebugManifest
:CordovaLib:javaPreCompileDebug
:CordovaLib:processDebugJavaRes NO-SOURCE
:app:preBuild UP-TO-DATE
:app:preDebugBuild FAILED

FAILURE: Build failed with an exception.

BUILD FAILED in 8s
11 actionable tasks: 11 executed
(node:19552) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

BUILD FAILED in 8s
at ChildProcess.whenDone (C:\Users\zcoffin\Documents\switchboard\firebasetest\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:961:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
(node:19552) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:19552) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Most helpful comment

I modified:

allprojects {
    repositories {
        jcenter()

to:

allprojects {
    repositories {
        jcenter { url "http://jcenter.bintray.com/"}

in files:

platforms/android/build.gradle

following some advice from https://forum.ionicframework.com/t/build-fails-on-android-could-not-resolve-all-files-for-configuration/119024 and now it builds. Can someone explain to me what's going on? Is this an issue with Cordova or Gradle or the external repositories or this plugin or ... ?

All 12 comments

I modified:

allprojects {
    repositories {
        jcenter()

to:

allprojects {
    repositories {
        jcenter { url "http://jcenter.bintray.com/"}

in files:

platforms/android/build.gradle

following some advice from https://forum.ionicframework.com/t/build-fails-on-android-could-not-resolve-all-files-for-configuration/119024 and now it builds. Can someone explain to me what's going on? Is this an issue with Cordova or Gradle or the external repositories or this plugin or ... ?

I have same problem,

Did you fix this?

I need to fix this.

MY IONIC INFO:

`
cli packages: (/Users/wilfredonoyola/workspace/statusfy/sf-ionic-1/node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.1.10
Cordova Platforms  : android 7.0.0
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
ios-deploy        : 1.9.2 
Node              : v6.11.3
npm               : 3.10.10 
OS                : macOS High Sierra
Xcode             : Xcode 9.4.1 Build version 9F2000

Environment Variables:

ANDROID_HOME : /Users/wilfredonoyola/Library/Android/sdk/

Misc:

backend : pro`

See my comment above. It seems that jcenter might have different packages available on http vs https. I have no idea why.

@zcoffin86 thank you so much for this, i had the same error using this plugin and cordova-plugin-firebase-authentication and your solution fixed it for both plugins

You could also simply put maven before jcenter, then as long as the package is in maven gradle won't bother checking jcenter.

closing as resolved

{ url "http://jcenter.bintray.com/"}

it's working good in normal build. But i have error -

Execution failed for task ':app:lintVitalRelease'.

Could not resolve all artifacts for configuration ':app:debugAndroidTestRuntimeClasspath'.
Could not find livedata-core.aar (android.arch.lifecycle:livedata-core:1.1.0).
Searched in the following locations:
http://jcenter.bintray.com/android/arch/lifecycle/livedata-core/1.1.0/livedata-core-1.1.0.aar
Could not find common.jar (android.arch.lifecycle:common:1.1.0).
Searched in the following locations:
http://jcenter.bintray.com/android/arch/lifecycle/common/1.1.0/common-1.1.0.jar
Could not find runtime.aar (android.arch.core:runtime:1.1.0).
Searched in the following locations:
http://jcenter.bintray.com/android/arch/core/runtime/1.1.0/runtime-1.1.0.aar
Could not find common.jar (android.arch.core:common:1.1.0).
Searched in the following locations:
http://jcenter.bintray.com/android/arch/core/common/1.1.0/common-1.1.0.jar
Could not find viewmodel.aar (android.arch.lifecycle:viewmodel:1.1.0).
Searched in the following locations:
http://jcenter.bintray.com/android/arch/lifecycle/viewmodel/1.1.0/viewmodel-1.1.0.aar
---with release build please help :+1:

if @zcoffin86 solution doesn't work, try this: https://stackoverflow.com/a/50565175/5576333

I wonder if using platform android 7.1.1 would fix?

thanks..

if @zcoffin86 solution doesn't work, try this: https://stackoverflow.com/a/50565175/5576333

thanks

@Esom that's what we ended up doing for a while, but cordova platform android 7.1.x seemed to have solved this, at least on all of our dev machines. 3rd party integrations are another matter!

the best solution for me has been cordova plugin add https://github.com/wizpanda/cordova-plugin-firebase

Was this page helpful?
0 / 5 - 0 ratings