Google Play服务版本冲突问题

时间:2018-08-27 04:42:37

标签: android angularjs cordova ionic-framework

我目前正在使用cordova-plugin-googleplus 5.0.0插件进行Gmail集成,并使用cordova-plugin-fcm 2.1.2进行Ionic1蚀中的Push Notification。我已经从链接https://github.com/vizZ/google-play-services_lib

下载了Google Play服务库。

请在我的gradle配置下面找到

Build.gradle

apply plugin: 'com.android.application'

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }

    // Switch the Android Gradle plugin version requirement depending on the
    // installed version of Gradle. This dependency is documented at
    // http://tools.android.com/tech-docs/new-build-system/version-compatibility
    // and https://issues.apache.org/jira/browse/CB-8143
    dependencies {
        classpath 'com.google.gms:google-services:3.2.0'
        classpath 'com.android.tools.build:gradle:2.2.1'
    }
}

    // Allow plugins to declare Maven dependencies via build-extras.gradle.
    allprojects {
    repositories {
    jcenter()
    maven {
        url "https://maven.google.com"
      }
    }
    }

    task wrapper(type: Wrapper) {
        gradleVersion = '2.14.1'
    }


        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.android.support:support-v4:25.+"
            compile "com.android.support:appcompat-v7:25.+"
            compile "com.android.support:support-v4:+"
            compile "com.google.firebase:firebase-core:+"
            compile "com.google.firebase:firebase-messaging:+"
            // SUB-PROJECT DEPENDENCIES END
        }

在使用上述配置运行时,我的应用程序崩溃并给出以下错误,但是当我删除cordova-plugin-fcm gmail时,集成工作正常。

java.lang.NoClassDefFoundError: com.google.firebase.FirebaseApp
  at com.google.firebase.iid.FirebaseInstanceId.getInstance (Unknown Source)
  at com.google.firebase.messaging.FirebaseMessaging.getInstance (Unknown Source:9)
  at com.gae.scaffolder.plugin.FCMPlugin.initialize (FCMPlugin.java:36)
  at org.apache.cordova.CordovaPlugin.privateInitialize (CordovaPlugin.java:57)
  at org.apache.cordova.PluginManager.getPlugin (PluginManager.java:171)
  at org.apache.cordova.PluginManager.startupPlugins (PluginManager.java:97)
  at org.apache.cordova.PluginManager.init (PluginManager.java:86)
  at org.apache.cordova.CordovaWebViewImpl.init (CordovaWebViewImpl.java:115)
  at org.apache.cordova.CordovaActivity.init (CordovaActivity.java:149)
  at org.apache.cordova.CordovaActivity.loadUrl (CordovaActivity.java:224)
  at android.app.Activity.performCreate (Activity.java:7003)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1230)`enter code here`
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2899)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3046)
  at android.app.ActivityThread.-wrap11 (Unknown Source)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1688)
  at android.os.Handler.dispatchMessage (Handler.java:105)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:6798)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:767)
Caused by: java.lang.ClassNotFoundException: 
  at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:93)
  at java.lang.ClassLoader.loadClass (ClassLoader.java:379)

能帮我如何在一个应用程序中添加两个插件,以及必须为推送通知添加哪个firebase版本库。

谢谢。

0 个答案:

没有答案