Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle version conflict after adding cordova fcm plugin

After adding FCM Plugin to project it is not building anymore.

Where cordova is checking GRADLE version? From package.json? I've tried to change ANDROID_GRADLE_TOOLS_VERSION spec on package.json, without success.

cordova plugin add cordova-plugin-fcm-with-dependecy-updated
cordova run android
FCMPlugin: Support for Gradle v4 or lower is deprecated. Please upgrade to a newer version.FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not create task ':app:processDebugGoogleServices'.
   > Cannot create a proxy class for abstract class 'GoogleServicesTask'.
BUILD FAILED in 3s

I tried to use plugin version 7.0.8 as suggested by Tiago

cordova plugin add [email protected]

Now I have conflicts with the camera plugin

> Task :app:compileDebugJavaWithJavac
C:\myapp\app\platforms\android\app\src\main\java\org\apache\cordova\camera\CameraLauncher.java:40: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
                                 ^
C:\myapp\app\platforms\android\app\src\main\java\org\apache\cordova\camera\CordovaUri.java:25: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
                                 ^
C:\myapp\app\platforms\android\app\src\main\java\org\apache\cordova\camera\FileProvider.java:21: error: package android.support.v4.content does not exist
public class FileProvider extends android.support.v4.content.FileProvider {}
                                                            ^
C:\myapp\app\platforms\android\app\src\main\java\org\apache\cordova\camera\CameraLauncher.java:303: error: cannot find symbol
        this.imageUri = new CordovaUri(FileProvider.getUriForFile(cordova.getActivity(),
                                                   ^
  symbol:   method getUriForFile(Activity,String,File)
  location: class FileProvider
C:\myapp\app\platforms\android\app\src\main\java\org\apache\cordova\camera\CameraLauncher.java:801: error: cannot find symbol
                        Uri tmpFile = FileProvider.getUriForFile(cordova.getActivity(),
                                                  ^
  symbol:   method getUriForFile(Activity,String,File)
  location: class FileProvider
5 errors

> Task :app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

Removing fcm plugin camera plugin works again. Also its weird that even after removing fcm plugin it is still on the project and showing error messages on console

FCMPlugin.js:46 FCM: has been created
FCMPlugin.js:41 FCM: Ready error:  Class not found
FCMPlugin.js:43 FCM: Ready!
FCMPlugin.js:23 FCM: Error listening to native events Class not found
like image 664
fcaserio Avatar asked Nov 21 '25 20:11

fcaserio


1 Answers

So apparently, we will have to wait for the fcm plugin guys to fix this. There is this github issue opened a few days ago and it seems that they just have to update the version in the plugin.

A workaround for now is downgrade to a previous version. I used "cordova-plugin-fcm-with-dependecy-updated": "7.0.8" and is working.

Github issue: https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated/issues/222

like image 126
Tiago P. O. Avatar answered Nov 24 '25 21:11

Tiago P. O.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!