cordova 无法添加名为'googleServices'的扩展,因为已存在使用该名称注册的扩展,- Moodle移动的应用- Ionic - FCM

hec6srdp  于 2022-12-04  发布在  Go
关注(0)|答案(2)|浏览(205)

I am trying to add Notification feature in Moodle Mobile App using Firebase Cloud Messaging, and I am getting an error while building the Ionic app.
cordova build android Conflict found, edit-config changes from config.xml will overwrite plugin.xml changes Removing permission "android.permission.REQUEST_INSTALL_PACKAGES" from AndroidManifest.xml cordova-plugin-androidx-adapter: Processed 122 source files in 3077ms [cordova-plugin-push::before-compile] skipping before_compile hookscript. Checking Java JDK and Android SDK versions ANDROID_SDK_ROOT=/home/egp/Android/Sdk (recommended setting) ANDROID_HOME=/home/egp/Android/Sdk (DEPRECATED) Using Android SDK: /home/egp/Android/Sdk Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reused, use --status for details
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 41s 1 actionable task: 1 executed Subproject Path: CordovaLib Subproject Path: app Starting a Gradle Daemon, 1 busy and 2 incompatible and 1 stopped Daemons could not be reused, use --status for details
Configure project :app Adding classpath: com.google.gms:google-services:4.3.10 Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide ( https://goo.gle/kotlin-android-extensions-deprecation ) to start working with View Binding ( https://developer.android.com/topic/libraries/view-binding ) and the 'kotlin-parcelize' plugin. WARNING:: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed in version 7.0 of the Android Gradle plugin. For more information, see http://d.android.com/r/tools/update-dependency-configurations.html .
FAILURE: Build failed with an exception.
Where: Build file '/home/egp/moodleapp_with_notification_github/moodleapp/platforms/android/app/build.gradle' line: 352
What went wrong: A problem occurred evaluating project ':app'. Failed to apply plugin 'com.google.gms.google-services'. Cannot add extension with name 'googleServices', as there is an extension already registered with that name.
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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1m 11s Command failed with exit code 1: /home/egp/moodleapp_with_notification_github/moodleapp/platforms/android/gradlew cdvBuildDebug -b /home/egp/moodleapp_with_notification_github/moodleapp/platforms/android/build.gradle [ERROR] An error occurred while running subprocess cordova.
cordova build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.

d8tt03nd

d8tt03nd1#

看起来你正在加载的通知模块添加了googleServices,但你的应用已经添加了这个。
找到这样的行:

apply plugin: com.google.gms.googleservices.GoogleServicesPlugin

并在前面添加//注解掉它。然后重建项目,错误应该会消失!
或者,通过将config.xml中的此值更改为false,禁止平台添加GoogleServicePlugin。

<preference name="GradlePluginGoogleServicesEnabled" value="true" />

这将防止构建过程中添加谷歌服务插件,你的插件已经添加。

vc6uscn9

vc6uscn92#

感谢Mohsin,在config.xml中将此值更改为false解决了问题:

<preference name="GradlePluginGoogleServicesEnabled" value="false" />

相关问题