Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
614 views
in Technique[技术] by (71.8m points)

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:myappappplatformsandroidappsrcmainjavaorgapachecordovacameraCameraLauncher.java:40: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
                                 ^
C:myappappplatformsandroidappsrcmainjavaorgapachecordovacameraCordovaUri.java:25: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
                                 ^
C:myappappplatformsandroidappsrcmainjavaorgapachecordovacameraFileProvider.java:21: error: package android.support.v4.content does not exist
public class FileProvider extends android.support.v4.content.FileProvider {}
                                                            ^
C:myappappplatformsandroidappsrcmainjavaorgapachecordovacameraCameraLauncher.java:303: error: cannot find symbol
        this.imageUri = new CordovaUri(FileProvider.getUriForFile(cordova.getActivity(),
                                                   ^
  symbol:   method getUriForFile(Activity,String,File)
  location: class FileProvider
C:myappappplatformsandroidappsrcmainjavaorgapachecordovacameraCameraLauncher.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
question from:https://stackoverflow.com/questions/65941591/gradle-version-conflict-after-adding-cordova-fcm-plugin

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...