将com.google.android.gms的版本更新为9.2.0

时间:2016-10-28 14:44:54

标签: cordova ionic2 firebase-cloud-messaging

我正在使用Ionic 2。

我一直在使用Googles FCM服务进行推送通知。今天我的电脑坏了,我不得不重新安装// ... export default class SomeList extends React.Component { // ... render() { return <View style={{flex: 1}}> <CustomNavbar /> <ScrollView style={{marginTop: 35}} refreshControl={ <RefreshControl tintColor={$.config.colors.style} onRefresh={() => this._refreshList()} refreshing={this.state.listRefreshing} /> } > {this._renderItems()} </ScrollView> </View> } } 插件。现在在构建时,我收到以下错误:

phonegap-plugin-push

看起来必须更新某些内容,我认为在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 (information 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 more log output. 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 (information 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 more log output. 插件中需要更新的依赖项(即phonegap-plugin-push。)

有人知道如何在Angular / Ionic / Cordova / npm环境中更新此内容吗?

更多信息:

enter image description here

com.google.android.gms to 9.2.0

3 个答案:

答案 0 :(得分:3)

当我收到相同的错误消息时,我在错误消息的末尾也看到了以下内容:

Found com.google.android.gms:play-services-auth:+, but version 9.2.0 is needed for the google-services plugin.
Found com.google.android.gms:play-services-identity:+, but version 9.2.0 is needed for the google-services plugin.

我通过更改

中的文件platforms/android/project.properties内容来解决问题
cordova.system.library.1=com.google.android.gms:play-services-auth:+
cordova.system.library.2=com.google.android.gms:play-services-identity:+

cordova.system.library.1=com.google.android.gms:play-services-auth:9.2.0
cordova.system.library.2=com.google.android.gms:play-services-identity:9.2.0

检查您是否也看到有关上述特定gms服务的错误,然后进行相应更改

答案 1 :(得分:0)

您好,您可以尝试解决此问题,将需要该版本的插件(即com.google.android.gms至9.2.0。)下载到您的计算机上,在您的情况下,这将是phonegap-plugin-push 。打开插件的plugin.xml文件,在android框架部分,更改部分 <framework src="com.google.android.gms:play-services-gcm:9.8+"/>

<framework src="com.google.android.gms:play-services:9.2.0" />

保存您的工作,从项目中删除插件并再次添加插件,这次从您的位置机器添加插件而不是git存储库。(cordova插件添加我的/本地/文件夹)。我有同样的挑战但是使用cordova-plugin-admobpro和cordova-plugin-fcm一起使用,这些更改帮助我解决了我遇到的问题,

答案 2 :(得分:0)

得到同样的问题,我的解决方案是卸载phonegap-plugin-push并删除android平台,然后再次添加android平台并安装phonegap-plugin-push,见下文:

我的行动:

ionic cordova plugin remove phonegap-plugin-push
ionic cordova platform remove android
ionic cordova plugin add phonegap-plugin-push
ionic cordova build android
ionic cordova run android

......它有效! ;)