4

this is the Error

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

In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[19.0. 1]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

Dependency failing: com.google.firebase:firebase-messaging:19.0.1 -> com.google.firebase:firebase-iid@[19.0.1], but fire base-iid version was 20.0.2.

The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art ifact with the issue.]Here is the command prompt picture---view

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90

5 Answers5

5

Happened to me today as well. In my case, I solved it by changing in the package.json file the firebase messaging version to 20.1.+, although I had an earlier version than 19.0.1, so maybe it won't work for your project.

Update:

If you are using a cordova plugin, then it depends on how you can specify to that plugin which version of the Google's messaging library you want to use.

For example in my case, I'm using the cordova-plugin-firebase-messaging that has the following statement in the readme:

Use variables FIREBASE_ANALYTICS_VERSION, FIREBASE_MESSAGING_VERSION and ANDROIDX_CORE_VERSION to override dependency versions on Android.

So, in my package.json, i'd include the following:

{
    ...
    "dependencies": {
        ...
        "cordova-plugin-firebase-messaging": "4.0.1"
    },
    "cordova" : {
        ...
        "plugins": {
            "cordova-plugin-firebase-messaging": {
                "FIREBASE_MESSAGING_VERSION": "20.1.+"
            }
        }
    }
}

But this is only for this cordova plugin, if you are using another, take a look in their readme to check if you can specify the version for the native messaging library.

Sogeking
  • 780
  • 8
  • 19
  • firebase-messaging does not show up in package.json .. I only have "cordova-plugin-firebase": "2.0.5", "cordova-plugin-firebase-lib": "^4.1.0", – Scobee Jan 16 '20 at 08:37
  • Thank you for your response..Is it a temporary bug. – Sachin Priyaprathapan Jan 16 '20 at 08:55
  • And i also ain't seen any firebase messaging version in the package.json file – Sachin Priyaprathapan Jan 16 '20 at 08:58
  • 1
    If you are using a cordova plugin for firebase, then it depends on what version of google's firebase library is the plugin using. For example, https://github.com/chemerisuk/cordova-plugin-firebase-messaging this cordova plugin has the FIREBASE_MESSAGING_VERSION property for the package json, so you can state which version you want to include, and in the plugin section of the package.json I'd include: "cordova-plugin-firebase-messaging": { "FIREBASE_MESSAGING_VERSION": "20.1.+" } But take into account that this depends on which cordova plugin are you using. – Sogeking Jan 16 '20 at 09:02
  • nope ...still failing .There is no issues 2 days ago ..and i tried to change the build.gradle and so many stuff but it wont work for me... – Sachin Priyaprathapan Jan 16 '20 at 09:06
  • I am using https://github.com/arnesson/cordova-plugin-firebase .. this is for an ionic project – Scobee Jan 16 '20 at 09:09
  • Glad to hear it :) I've updated the answer with more details for cordova plugins – Sogeking Jan 16 '20 at 09:19
  • @SachinPriyaprathapan - are you using firebase in an ionic project ? if so, did you also add firebase-messaging alongside firebase ? – Scobee Jan 16 '20 at 09:23
  • nope i am using Apache cordova....but there is a problem in the above solution...it created the build but the notification ain't coming ..any suggestion? – Sachin Priyaprathapan Jan 17 '20 at 05:39
  • Good news i managed to slove the entire problm with this article..... https://stackoverflow.com/questions/58745558/cordova-firebase-plugin-failures?rq=1 – Sachin Priyaprathapan Jan 17 '20 at 06:35
2

If you are using the cordova-plugin-fcm-with-dependecy-updated. Change the FCM_VERSION on the package.json to 20.1.+

Hope it helps!

Alejandro Barone
  • 1,743
  • 2
  • 13
  • 24
1

I resolved it using

  "cordova-plugin-fcm-with-dependecy-updated": {
    "FCM_CORE_VERSION": "16.0.9",
    "FCM_VERSION": "20.1.+",
    "GRADLE_TOOLS_VERSION": "3.5.0",
    "GOOGLE_SERVICES_VERSION": "4.2.0",
    "ANDROID_DEFAULT_NOTIFICATION_ICON": "@mipmap/ic_launcher"
  },

and

"cordova-plugin-firebase-analytics": {
    "FIREBASE_ANALYTICS_COLLECTION_ENABLED": "true",
    "FIREBASE_ANALYTICS_VERSION": "17.4.+"
  }

in package.json

  • I have tried the same in package.json. then I am doing `cordova prepare android` but versions taking as per package.json. FCM_VERSION is sill 19.0.0 in android (project.properties). Even I have tried this, `cordova platform rm android` => `cordova platform add android@8.1.0` but no luck. please help me if I am doing something wrong.. – iamhimadri Jun 11 '20 at 06:28
  • Few code snippets here regards to my above comment, https://gist.github.com/iamhimadri/d54708b80254660dfdc2a15fe32bd97d – iamhimadri Jun 11 '20 at 06:42
0

This Worked. Changing only the version in package.json did not work. I don't know why.

If at all viable, I would recommend upgrading your ionic framework to the latest version. But if that is not viable, here is how I resolved the issue for one of our legacy projects.

You can force firebase to use the correct version of firebase-messaging by changing

com.google.firebase:firebase-messaging:19.+
com.google.firebase:firebase-messaging:20.+

in the following files:

  • platforms\android\project.properties
  • platforms\android\app\build.gradle
  • plugins\cordova-plugin-firebase-lib\plugin.xml
0

The same issue happened with me. For me, changing gradle worked.

I changed following inside gradle-wrapper.properties

from

distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

to

distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
Abhishek Kumar
  • 4,532
  • 5
  • 31
  • 53