Cordova-plugin-firebase: Can't build on android anymore

Created on 18 Jun 2019  ·  59Comments  ·  Source: arnesson/cordova-plugin-firebase

I was developing my application normally. I was able to build it 10 times today successfully.
However, I was compile again and now I can no longer run when the firebase plugin is in the project.

If I remove the plugin the project run.

Im using [email protected] (can't update to 8.0.0)

The following build error occurs:

:app:processDebugResources/home/sandro/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/c9104c96e21bf9c9613f4661f4e5d49e/res/values/values.xml:246:5-69: AAPT: error: resource android:attr/fontVariationSettings not found.

/home/sandro/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/c9104c96e21bf9c9613f4661f4e5d49e/res/values/values.xml:246:5-69: AAPT: error: resource android:attr/ttcIndex not found.

/home/user/my_cordova_project/platforms/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:244: error: resource android:attr/fontVariationSettings not found.
/home/user/my_cordova_project/platforms/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:244: error: resource android:attr/ttcIndex not found.
error: failed linking references.

Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
    at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
    at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
    at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)
    at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
    at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
    at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
    at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
    at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:794)
    ... 48 more
Caused by: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
    at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
    at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)
    at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
    at com.android.builder.internal.aapt.v2.QueueableAapt2.lambda$makeValidatedPackage$1(QueueableAapt2.java:179)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    ... 1 more
Caused by: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
    at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:463)
    at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:415)
    at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:332)
    at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.

Anyone else having the same problem? Thanks.

Most helpful comment

Solution I've taken from this comment https://github.com/arnesson/cordova-plugin-firebase/issues/1081#issuecomment-503041641

  1. put build-extras.gradle in your project root
def dependencyMap = [
        "com.google.firebase:firebase-core": "16.0.8",
        "com.google.firebase:firebase-iid": "17.1.1",
        "com.google.firebase:firebase-messaging": "17.5.0",
        "com.google.firebase:firebase-config": "16.4.0",
        "com.google.firebase:firebase-perf": "16.2.4",
        "com.google.android.gms:play-services-tagmanager": "16.0.8",
        "com.google.firebase:firebase-auth": "16.2.0"
]

allprojects {
    repositories {
            google()
            jcenter()
            mavenLocal()
    }

    configurations.all {

        resolutionStrategy {

            eachDependency { DependencyResolveDetails details ->
                def group = details.requested.group
                def name = details.requested.name
                def fullName =  group + ":" + name
                print fullName
                if (dependencyMap.containsKey(fullName)) {
                    details.useVersion dependencyMap[fullName]
                }
            }
        }
    }

}
  1. put this hook code in your scripts/copy_build_extra.js
#!/usr/bin/env node

const fs = require('fs')
fs.copyFileSync("./build-extras.gradle", "./platforms/android/build-extras.gradle");
  1. configure hook in config.xml inside android platform
<platform name="android">
  <hook src="scripts/copy_build_extra.js" type="after_prepare" />
</platform>
  1. reinstall platform to activate the hook
cordova platform rm android
cordova platform add android

worked for me, hope will do for you too

All 59 comments

have been fighting the same issue for three days already

Hello @SandroMoretti,

I have been fighting all the day with that issue... My project cannot be updated to Cordova 8 either so I even decided to port to Ionic 4 (it was done with Ionic 3). So, with Cordova 8 and Ionic 4 after many errors I have arrived to the same point... The error that you have posted is related to Android 28, and the reason is because this library uses 'com.google.firebase:firebase-X:+' as a dependency and yesterday Firebase did a breaking release FB June 17 which forces to use Android 28... I have been playing with dependencies to see if I could workaround it but always got another error...

Any help would be appreciated, thanks!

Same here. I think It's because the plugin depends on com.google.firebase:firebase-auth:+ which just updated:

https://developers.google.com/android/guides/releases

Dropped support for API <28

Same problem too! I can't build on android anymore.

I am having the same problem, now I cannot compile the app and get this error:

:app:processDebugResources
C:\Users\mmzep\.gradle\caches\transforms-1\files-1.1\core-1.0.0.aar\73b4a83ab5e76f20c84a66b1c8444d08\res\values\values.xml:133:5-70: AAPT: error: resource android:attr/fontVariationSettings not found.

C:\Users\mmzep\.gradle\caches\transforms-1\files-1.1\core-1.0.0.aar\73b4a83ab5e76f20c84a66b1c8444d08\res\values\values.xml:133:5-70: AAPT: error: resource android:attr/ttcIndex not found.

C:\Users\mmzep\Desktop\mario\Seven\SevenPassengerApp\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:95: error: resource android:attr/fontVariationSettings not found.
C:\Users\mmzep\Desktop\mario\Seven\SevenPassengerApp\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:95: error: resource android:attr/ttcIndex not found.
error: failed linking references.

Failed to execute aapt

com.android.ide.common.process.ProcessException: Failed to execute aapt

        at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
        at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
        at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)
        at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

I'm on a really tight deadline and this breaks my project since it relies entirely on firebase.

Same problem here. I've tried to update all dependencies with requirements at https://firebase.google.com/support/release-notes/android#20180523, and cordova android to 8.0.0, but with no success. When I remove cordova-plugin-firebase, it works. Here the error I get:

Dependency failing: com.google.android.gms:play-services-tagmanager-api:15.0.2 -> com.google.android.gms:play-services-m
  easurement-base@[15.0.2], but play-services-measurement-base version was 15.0.4.

  The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
  ifact with the issue.
  -- Project 'app' depends onto com.google.android.gms:[email protected]
  -- Project 'app' depends onto com.google.firebase:[email protected]
  -- Project 'app' depends onto com.google.android.gms:[email protected]
  -- Project 'app' depends onto com.google.android.gms:[email protected]
  -- Project 'app' depends onto com.google.android.gms:[email protected]
  -- Project 'app' depends onto com.google.android.gms:[email protected]

So can't build with firebase.

This morning I'm already sweating as I saw the gradle downloading new maven files and to my expectations it all went boom!

Same here. any solution please

Solution I've taken from this comment https://github.com/arnesson/cordova-plugin-firebase/issues/1081#issuecomment-503041641

  1. put build-extras.gradle in your project root
def dependencyMap = [
        "com.google.firebase:firebase-core": "16.0.8",
        "com.google.firebase:firebase-iid": "17.1.1",
        "com.google.firebase:firebase-messaging": "17.5.0",
        "com.google.firebase:firebase-config": "16.4.0",
        "com.google.firebase:firebase-perf": "16.2.4",
        "com.google.android.gms:play-services-tagmanager": "16.0.8",
        "com.google.firebase:firebase-auth": "16.2.0"
]

allprojects {
    repositories {
            google()
            jcenter()
            mavenLocal()
    }

    configurations.all {

        resolutionStrategy {

            eachDependency { DependencyResolveDetails details ->
                def group = details.requested.group
                def name = details.requested.name
                def fullName =  group + ":" + name
                print fullName
                if (dependencyMap.containsKey(fullName)) {
                    details.useVersion dependencyMap[fullName]
                }
            }
        }
    }

}
  1. put this hook code in your scripts/copy_build_extra.js
#!/usr/bin/env node

const fs = require('fs')
fs.copyFileSync("./build-extras.gradle", "./platforms/android/build-extras.gradle");
  1. configure hook in config.xml inside android platform
<platform name="android">
  <hook src="scripts/copy_build_extra.js" type="after_prepare" />
</platform>
  1. reinstall platform to activate the hook
cordova platform rm android
cordova platform add android

worked for me, hope will do for you too

this is the best solution, with less "hacks" to do: https://github.com/arnesson/cordova-plugin-firebase/issues/1081#issuecomment-503135862 (requires cordova-android@8)

Thank you @igorkurochka , really work again.

PS: I'm using cordova 6.5 and Android 7.1.4, so don't need to update to android 8 like dann told.

@SandroMoretti i guess is good if you can update, do it.. cause this plugin will generate more headaches, since april im using a fork of the plugin, to solve a build issue, i was using cordova-android@7, seems some library that is dependency of this plugin is no more suporting API < 28, so its good to use cordova-android@8 that uses API 28...

@dann95 , I know. I tried update. I don't know why, but I can't update my cordova.

Npm just install cordova 6.5 here. Maybe is my outdated system (ubuntu 14).
Someday I will reserve my day to upgrade my OS then I update cordova and android platform.
Thank you.

your Cordova cli is installed globally, you must remove it globally. "-g" xD

@SandroMoretti i guess is good if you can update, do it.. cause this plugin will generate more headaches, since april im using a fork of the plugin, to solve a build issue, i was using cordova-android@7, seems some library that is dependency of this plugin is no more suporting API < 28, so its good to use cordova-android@8 that uses API 28...

Before cordova-plugin-firebase directory was 93,9 MB, now 1,30 MB.
Before cordova-plugin-cocoapod-support was not installed, now it is.

Same for you also?

@pegasx
cocoapod-support not installed for me.

@pegasx
cocoapod-support not installed for me.

Sorry, you did not install dpa99c's solution. So question is for @dann95.

Before cordova-plugin-firebase directory was 93,9 MB, now 1,30 MB.
Before cordova-plugin-cocoapod-support was not installed, now it is.

Same for you also?

image

cocoapod must be for "swift" it has been installed in my linux too, will investigate why

about the size, idk what was the size before, but it seems to work.

this solution worked for me, but I had to create a new project and copy all my files into that new project because using the steps in the link made more problems on the existing repository ...

Thank you @igorkurochka , working again.

@igorkurochka
Thanks for your fix. It works on my end too. My understanding is that the below list is the dependencies of the firbase plugin. Shouldn't these be defined by the plugin itself? Adding these to the android project using an external cordova hook looks like a workaround, but not a solution. Is there a chance to create a pull request to get the exact versions of the dependencies defined in the master repo? Thanks.

```
def dependencyMap = [
"com.google.firebase:firebase-core": "16.0.8",
"com.google.firebase:firebase-iid": "17.1.1",
"com.google.firebase:firebase-messaging": "17.5.0",
"com.google.firebase:firebase-config": "16.4.0",
"com.google.firebase:firebase-perf": "16.2.4",
"com.google.android.gms:play-services-tagmanager": "16.0.8",
"com.google.firebase:firebase-auth": "16.2.0"
]

@SandroMoretti
True is that @igorkurochka fixed the issue but this is more of a workaround and not a solution. The versions of the plugin's dependencies should be defined by the plugin and not the cordova app. This fix may become unreliable, should the dependencies of the plugin change.

I suggest reopening this issue.

Solution I've taken from this comment #1081 (comment)

  1. put build-extras.gradle in your project root
def dependencyMap = [
        "com.google.firebase:firebase-core": "16.0.8",
        "com.google.firebase:firebase-iid": "17.1.1",
        "com.google.firebase:firebase-messaging": "17.5.0",
        "com.google.firebase:firebase-config": "16.4.0",
        "com.google.firebase:firebase-perf": "16.2.4",
        "com.google.android.gms:play-services-tagmanager": "16.0.8",
        "com.google.firebase:firebase-auth": "16.2.0"
]

allprojects {
    repositories {
            google()
            jcenter()
            mavenLocal()
    }

    configurations.all {

        resolutionStrategy {

            eachDependency { DependencyResolveDetails details ->
                def group = details.requested.group
                def name = details.requested.name
                def fullName =  group + ":" + name
                print fullName
                if (dependencyMap.containsKey(fullName)) {
                    details.useVersion dependencyMap[fullName]
                }
            }
        }
    }

}
  1. put this hook code in your scripts/copy_build_extra.js
#!/usr/bin/env node

const fs = require('fs')
fs.copyFileSync("./build-extras.gradle", "./platforms/android/build-extras.gradle");
  1. configure hook in config.xml inside android platform
<platform name="android">
  <hook src="scripts/copy_build_extra.js" type="after_prepare" />
</platform>
  1. reinstall platform to activate the hook
cordova platform rm android
cordova platform add android

worked for me, hope will do for you too

Hi @igorkurochka , I'm still facing this type of issue, can you please help me in that
platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:9: error: cannot find symbol
import android.support.v4.app.NotificationManagerCompat;

@pankajPizone have you deleted the gradle cache?

rm -rf ~/.gradle/

@dann95 from android folder?

the "~" means your home , so it will clear something like

/home/myusername/.gradle/

OK @dann95 i'm trying it

@dann95 its still same

All right.
Open again.
Thanks @uifox

Dan, about my cordova cli, I has been removed globally and reinstall globally.
Is like I said, after reinstall keep 6.5.

Thanks.

@SandroMoretti did you find any solution?
I'm facing this issue
firebase/FirebasePluginMessagingService.java:11: error: cannot find symbol
import android.support.v4.app.NotificationCompat;

@SandroMoretti maybe upgrading node version? try using nvm to be able to switch easily between node versions..

@pankajPizone can you show your config.xml with all plugins?

@dann95 here is plugin in config.xml

<plugin name="cordova-plugin-statusbar" spec="^2.4.2" />
    <plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
    <plugin name="cordova-plugin-ionic-webview" spec="^2.4.0">
        <variable name="ANDROID_SUPPORT_ANNOTATIONS_VERSION" value="27.+" />
    </plugin>
    <plugin name="cordova-plugin-ionic-keyboard" spec="^2.1.3" />
    <plugin name="cordova-plugin-firebase" spec="^2.0.5" />
    <plugin name="cordova-plugin-facebook4" spec="^4.2.1">
        <variable name="APP_ID" value="xxxxxx" />
        <variable name="APP_NAME" value="x x" />
        <variable name="FACEBOOK_ANDROID_SDK_VERSION" value="4.38.1" />
        <variable name="FACEBOOK_HYBRID_APP_EVENTS" value="false" />
    </plugin>
    <plugin name="cordova-plugin-nativegeocoder" spec="^3.2.0" />
    <plugin name="cordova-plugin-geolocation" spec="^4.0.1">
        <variable name="GEOLOCATION_USAGE_DESCRIPTION" value="To locate you" />
    </plugin>
    <plugin name="cordova-plugin-appavailability" spec="^0.4.2" />
    <plugin name="cordova-plugin-media" spec="^5.0.2" />
    <plugin name="cordova-plugin-music-controls" spec="^2.2.0" />
    <plugin name="cordova-plugin-contacts" spec="^3.0.1" />
    <plugin name="cordova-plugin-applemusic" spec="^1.3.3" />
    <plugin name="cordova-plugin-apple-music" spec="^0.2.5" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
    <plugin name="com.telerik.plugins.nativepagetransitions" spec="^0.6.5" />
    <plugin name="cordova-plugin-applemusic" spec="^1.3.3" />
    <plugin name="cordova-plugin-apple-music" spec="^0.2.5" />
    <plugin name="cordova-plugin-add-swift-support" spec="1.7.2" />
    <allow-navigation href="http://192.168.1.120:8100" sessionid="8e9a7c7b" />
    <plugin name="com.telerik.plugins.nativepagetransitions" spec="0.6.5" />
  <plugin name="cordova-plugin-googleplus" spec="7.0.0">
        <variable name="REVERSED_CLIENT_ID" value="com.googleusercontent.apps.xxxxxxx" />
        <variable name="WEB_APPLICATION_CLIENT_ID" value="xxxxx-xxxxxxx.apps.googleusercontent.com" />
        <variable name="PLAY_SERVICES_VERSION" value="11.8.0" />
    </plugin>
    <plugin name="cordova-plugin-device" spec="../../cordova-plugin-device" />
    <plugin name="uk.co.workingedge.phonegap.plugin.launchnavigator" spec="5.0.4">
        <variable name="GOOGLE_API_KEY_FOR_ANDROID" value="xxxxx" />
        <variable name="OKHTTP_VERSION" value="3.12.0" />
    </plugin>
    <plugin name="cordova-plugin-customurlscheme" spec="4.3.0">
        <variable name="URL_SCHEME" value="spotifyapp" />
        <variable name="ANDROID_SCHEME" value=" " />
        <variable name="ANDROID_HOST" value=" " />
        <variable name="ANDROID_PATHPREFIX" value="/" />
    </plugin>
    <plugin name="cordova-spotify-oauth" spec="0.1.11" />
    <plugin name="cordova-spotify" spec="0.5.8" />
    <plugin name="cordova-plugin-geofence" spec="0.7.0" />
    <engine name="ios" spec="4.5.5" />
    <engine name="android" spec="8.0.0" />

@dann95 is it helpful to find issue?

@pankajPizone i have no idea why, have u tried to remove and add platform again?

@dann95 I have try many time.

I have fixed these issue using two plugins

ionic cordova plugin add cordova-plugin-androidx
ionic cordova plugin add cordova-plugin-androidx-adapter

@pankajPizone i use this two plugins too, but i updated my cordova version, thats the reason to use them...

I'm still having problems with this update:

  • What went wrong:
    Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.

    Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
    Could not find any version that matches androidx.legacy:legacy-support-v4:27.+.
    Versions that do not match:

    • 1.0.0
    • 1.0.0-rc02
    • 1.0.0-rc01
    • 1.0.0-beta01
    • 1.0.0-alpha3

      • 1 more

        Required by:

        project :app

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 58s
C:UsersAdminDesktopOMNICARomnicarplatformsandroidgradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
    > Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
    > Could not find any version that matches androidx.legacy:legacy-support-v4:27.+.
    Versions that do not match:

    • 1.0.0

    • 1.0.0-rc02

    • 1.0.0-rc01

    • 1.0.0-beta01

    • 1.0.0-alpha3



      • 1 more


        Required by:


        project :app



It looks like when i add a platform dependencies in build.gradle are right, but when i execute "cordova compile" it turns my dependencies into the wrong ones again.

cordova plugin ls
cordova-fabric-plugin 1.1.14-dev "cordova-fabric-plugin"
cordova-plugin-android-permissions 1.0.0 "Permissions"
cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
cordova-plugin-androidx-adapter 1.0.2 "cordova-plugin-androidx-adapter"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-cocoapod-supportx 1.6.1 "Cordova CocoaPods Dependency Support"
cordova-plugin-crop 0.3.1 "CropPlugin"
cordova-plugin-device 1.1.7 "Device"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-filechooser 1.2.0 "File Chooser"
cordova-plugin-filepath 1.5.5 "cordova-plugin-filepath"
cordova-plugin-firebasex 2.0.6 "Google Firebase Plugin"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-googlemaps 2.6.3-20190614-1928 "cordova-plugin-googlemaps"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 2.5.0 "cordova-plugin-ionic-webview"
cordova-plugin-screen-orientation 3.0.1 "Screen Orientation"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlite-storage 3.2.0 "Cordova sqlite storage plugin - cordova-sqlite-storage plugin version"
es6-promise-plugin 4.2.2 "Promise"
info.protonet.imageresizer 0.1.1 "Image Resizer"
onesignal-cordova-plugin 2.4.7 "OneSignal Push Notifications"

I'm having the issue too for error: cannot find symbol class NotificationManagerCompat. I'd love to see a PR to get this fixed. I'm currently forked off of the wizpanda fork.

I have fixed these issue using two plugins

ionic cordova plugin add cordova-plugin-androidx
ionic cordova plugin add cordova-plugin-androidx-adapter

Mine is built successfully also with this solution, but it happens to be some kind of error which makes my app unusable. Is like if the plugins wouldn't be accessible, I added them correctly though. Actually adb logcat throws:
AndroidProtocolHandler: Unable to open asset URL: file:///android_asset/www/cordova_plugins.js
But I'm pretty sure I created the project correctly. Completely lost.

@AurumLinux You should try to rebuild your app step by step starting with the commands in this comment...
I was also buried in errors when I tried to simply install the plugins on top of my existing old project.

The problem was that I was adding the cordova-plugin-admobpro-firebase plugin instead of the cordova-plugin-admobpro. Now its working OK.

cordova-plugin-firebase -> src -> android - > build.gradle change line no 20 com.google.firebase:firebase-auth:+ to com.google.firebase:firebase-auth:16.2.1

it works good with :

ionic cordova plugin add cordova-plugin-androidx
ionic cordova plugin add cordova-plugin-androidx-adapter

it works good with :

ionic cordova plugin add cordova-plugin-androidx
ionic cordova plugin add cordova-plugin-androidx-adapter

@fvadouko what android are you using? 7.1 or 8.0 ? any other compat libraries or fixes?

@AurumLinux You should try to rebuild your app step by step starting with the commands in this comment...
I was also buried in errors when I tried to simply install the plugins on top of my existing old project.

I've struggled with this bug for a few days now. once I switched over to the fork from the linked comment, everything worked

Solution I've taken from this comment #1081 (comment)

  1. put build-extras.gradle in your project root
def dependencyMap = [
        "com.google.firebase:firebase-core": "16.0.8",
        "com.google.firebase:firebase-iid": "17.1.1",
        "com.google.firebase:firebase-messaging": "17.5.0",
        "com.google.firebase:firebase-config": "16.4.0",
        "com.google.firebase:firebase-perf": "16.2.4",
        "com.google.android.gms:play-services-tagmanager": "16.0.8",
        "com.google.firebase:firebase-auth": "16.2.0"
]

allprojects {
    repositories {
            google()
            jcenter()
            mavenLocal()
    }

    configurations.all {

        resolutionStrategy {

            eachDependency { DependencyResolveDetails details ->
                def group = details.requested.group
                def name = details.requested.name
                def fullName =  group + ":" + name
                print fullName
                if (dependencyMap.containsKey(fullName)) {
                    details.useVersion dependencyMap[fullName]
                }
            }
        }
    }

}
  1. put this hook code in your scripts/copy_build_extra.js
#!/usr/bin/env node

const fs = require('fs')
fs.copyFileSync("./build-extras.gradle", "./platforms/android/build-extras.gradle");
  1. configure hook in config.xml inside android platform
<platform name="android">
  <hook src="scripts/copy_build_extra.js" type="after_prepare" />
</platform>
  1. reinstall platform to activate the hook
cordova platform rm android
cordova platform add android

worked for me, hope will do for you too

TOP 👏🏽

Thank you @igorkurochka It works. I was struggling with this.

I have the problem
FirebasePlugin.java:365: error: cannot find symbol

Thanks to @igorkurochka. It worked with my project.

@igorkurochka its worked here as well thanks

Solution I've taken from this comment #1081 (comment)

1. put `build-extras.gradle` in your project root
def dependencyMap = [
        "com.google.firebase:firebase-core": "16.0.8",
        "com.google.firebase:firebase-iid": "17.1.1",
        "com.google.firebase:firebase-messaging": "17.5.0",
        "com.google.firebase:firebase-config": "16.4.0",
        "com.google.firebase:firebase-perf": "16.2.4",
        "com.google.android.gms:play-services-tagmanager": "16.0.8",
        "com.google.firebase:firebase-auth": "16.2.0"
]

allprojects {
    repositories {
            google()
            jcenter()
            mavenLocal()
    }

    configurations.all {

        resolutionStrategy {

            eachDependency { DependencyResolveDetails details ->
                def group = details.requested.group
                def name = details.requested.name
                def fullName =  group + ":" + name
                print fullName
                if (dependencyMap.containsKey(fullName)) {
                    details.useVersion dependencyMap[fullName]
                }
            }
        }
    }

}
1. put this hook code in your scripts/copy_build_extra.js
#!/usr/bin/env node

const fs = require('fs')
fs.copyFileSync("./build-extras.gradle", "./platforms/android/build-extras.gradle");
1. configure hook in config.xml inside android platform
<platform name="android">
  <hook src="scripts/copy_build_extra.js" type="after_prepare" />
</platform>
1. reinstall platform to activate the hook
cordova platform rm android
cordova platform add android

worked for me, hope will do for you too

Worked like a charm :). Fantastic solution.

Solution I've taken from this comment #1081 (comment)

  1. put build-extras.gradle in your project root
def dependencyMap = [
        "com.google.firebase:firebase-core": "16.0.8",
        "com.google.firebase:firebase-iid": "17.1.1",
        "com.google.firebase:firebase-messaging": "17.5.0",
        "com.google.firebase:firebase-config": "16.4.0",
        "com.google.firebase:firebase-perf": "16.2.4",
        "com.google.android.gms:play-services-tagmanager": "16.0.8",
        "com.google.firebase:firebase-auth": "16.2.0"
]

allprojects {
    repositories {
            google()
            jcenter()
            mavenLocal()
    }

    configurations.all {

        resolutionStrategy {

            eachDependency { DependencyResolveDetails details ->
                def group = details.requested.group
                def name = details.requested.name
                def fullName =  group + ":" + name
                print fullName
                if (dependencyMap.containsKey(fullName)) {
                    details.useVersion dependencyMap[fullName]
                }
            }
        }
    }

}
  1. put this hook code in your scripts/copy_build_extra.js
#!/usr/bin/env node

const fs = require('fs')
fs.copyFileSync("./build-extras.gradle", "./platforms/android/build-extras.gradle");
  1. configure hook in config.xml inside android platform
<platform name="android">
  <hook src="scripts/copy_build_extra.js" type="after_prepare" />
</platform>
  1. reinstall platform to activate the hook
cordova platform rm android
cordova platform add android

worked for me, hope will do for you too

Hi there, after working a while, I solved the problem with the Invalid Key: null issue. However, a new error message prompted:

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
The library com.google.android.gms:play-services-analytics-impl is being requested by various other libraries at [[16.0.8,16.0.8], [17.0.0,17.0.0]], but resolves to 17.0.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

If I downgrade 3 different libraries (play-services-analytics-impl, play-services-analytics and play-services-tagmanager-v4-impl) to the 16.0.8 in order to solve this issue, I get the " Crashlytics found an invalid API key: null." again. Obviously, I get the same message if I upgrade the "com.google.android.gms:play-services-tagmanager" to the 17.0.0

Any help?

Here is part of my config.xml
<platform name="android"> <allow-intent href="market:*" /> <hook src="hooks/android_build_extra.js" type="after_prepare" /> </platform> <platform name="ios"> <allow-intent href="itms:*" /> <allow-intent href="itms-apps:*" /> </platform> <platform name="android"> <preference name="android-minSdkVersion" value="19" /> <preference name="android-installLocation" value="auto" /> <preference name="disallowOverscroll" value="true" /> </platform> <platform name="ios"> </platform> <plugin name="cordova-plugin-device" spec="^2.0.2" /> <plugin name="cordova-plugin-globalization" spec="1.11.0" /> <plugin name="cordova-plugin-google-analytics" spec="1.8.6" /> <plugin name="cordova-plugin-inappbrowser" spec="3.0.0" /> <plugin name="cordova-plugin-splashscreen" spec="5.0.3" /> <plugin name="cordova-plugin-statusbar" spec="2.4.3" /> <plugin name="cordova-plugin-whitelist" spec="1.3.4" /> <plugin name="cordova-plugin-network-information" spec="2.0.2" /> <plugin name="com.lampa.startapp" spec="6.1.6" /> <plugin name="cordova-plugin-firebase" spec="2.0.5" /> <plugin name="cordova-android-play-services-gradle-release" spec="^4.0.0"> <variable name="PLAY_SERVICES_VERSION" value="11.0.+" /> </plugin> <plugin name="cordova-android-firebase-gradle-release" spec="^4.0.0"> <variable name="FIREBASE_VERSION" value="11.0.+" /> </plugin> <plugin name="cordova-android-support-gradle-release" spec="3.0.1"> <variable name="ANDROID_SUPPORT_VERSION" value="26.+" /> </plugin>

Any help on that?

Thanks,

Sergi

I have fixed these issue using two plugins

ionic cordova plugin add cordova-plugin-androidx
ionic cordova plugin add cordova-plugin-androidx-adapter

thanks a lot man!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JonSmart picture JonSmart  ·  3Comments

stephan-nordnes-eriksen picture stephan-nordnes-eriksen  ·  5Comments

merbin2012 picture merbin2012  ·  4Comments

jdla1990 picture jdla1990  ·  4Comments

rolinger picture rolinger  ·  5Comments