我在Android的Windows上使用此功能。当我添加cordova-plugin-fcm插件时,我无法再构建该项目。下面是我得到的错误:由于版本与Google gms服务的冲突,FCMPlugin构建失败
BUILD FAILED
Total time: 4.697 secs
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (i
nformation about the latest version is available at https://bintray.com/android/android-tools/com
.google.gms.google-services/) or updating the version of com.google.android.gms to 9.2.0.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get mor
e log output.
下面是我的config.xml中的一个片段:
<plugin name="cordova-plugin-console" spec="~1.0.3"/>
<plugin name="cordova-plugin-facebook4" spec="~1.7.3">
<variable name="APP_ID" value="XXX"/>
<variable name="APP_NAME" value="XXX"/>
</plugin>
<plugin name="cordova-plugin-whitelist" spec="~1.2.2"/>
<plugin name="cordova-plugin-statusbar" spec="~2.1.3"/>
<plugin name="cordova-plugin-splashscreen" spec="~3.2.2"/>
<plugin name="ionic-plugin-keyboard" spec="~2.2.1"/>
<plugin name="cordova-plugin-camera"/>
<plugin name="cordova-plugin-geolocation" spec="https://github.com/apache/cordova-plugin-geolocation"/>
<plugin name="cordova-plugin-googlemaps" spec="https://github.com/phonegap-googlemaps-plugin/cordova-plugin-googlemaps">
<variable name="API_KEY_FOR_ANDROID" value="XXXX"/>
<variable name="API_KEY_FOR_IOS" value="XXXX"/>
</plugin>
<plugin name="cordova-plugin-file-transfer" spec="~1.5.1"/>
<plugin name="cordova-plugin-file" spec="~4.2.0"/>
<plugin name="cordova-plugin-device" spec="~1.1.2"/>
我已阅读并this帖子this related这表明加入这行来的build.gradle (这是由离子自动创建的):
apply plugin: 'com.google.gms.google-services'
我已经尝试将它添加到build-extras.gradle中,但没有运气。
在我build.graddle,我看这样行:
// PLUGIN GRADLE EXTENSIONS START
apply from: "cordova-plugin-fcm/upfront-FCMPlugin.gradle"
// PLUGIN GRADLE EXTENSIONS END
以及这些行:
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
debugCompile project(path: "CordovaLib", configuration: "debug")
releaseCompile project(path: "CordovaLib", configuration: "release")
compile "com.facebook.android:facebook-android-sdk:4.14.+"
compile "com.google.android.gms:play-services-maps:+"
compile "com.google.android.gms:play-services-location:+"
// SUB-PROJECT DEPENDENCIES END
}
我缺少什么,我怎么能解决这个问题?
您是否找到了解决此问题的解决方案? – Astrowie
@Astrowie:没有,但你可以使用这个插件,其他:https://www.npmjs.com/package/cordova-plugin-firebase – Ari