在离子项目中用FCM创建android apk时如何解决错误?

时间:2017-01-02 18:37:41

标签: android cordova ionic-framework android-gradle apk

我已经使用FCM创建了一个离子项目。但是在安装FCM后它显示错误':processDebugGoogleServices'。我已经更新了SDK。如何解决这个问题并构建apk enter image description here



Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

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.




2 个答案:

答案 0 :(得分:0)

在build.gradle文件的末尾添加以下行并重建项目。

  

申请插件:'com.google.gms.google-services'

注意:请确保在该行的末尾添加以上行

查看link样本。

答案 1 :(得分:0)

"要解决此错误,请转到项目 - >平台..> android - > .gradlefile 并修改"

buildscript {
        repositories {
        jcenter()
        mavenLocal()
    }
dependencies {
    classpath 'com.android.tools.build:gradle:+'
    classpath 'com.google.gms:google-services:3.0.0'*  
}

} // apply plugin:' com.google.gms.google-services' //必须使用class而不是id(string)才能从非root gradle文件中应用插件 apply plugin:com.google.gms.googleservices.GoogleServicesPlugin