程序类型已经存在:android.arch.lifecycle.ViewModel

时间:2018-07-25 00:31:20

标签: android firebase onesignal

我想将onesignal与firebase-ui-database一起使用

在构建项目时遇到此问题

我认为onesignal和firebase-ui-database不能一起工作。

我的构建gradle(app):

plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.android.application'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.test.app"

        // TODO: Please update the OneSignal ID below to yours!
        manifestPlaceholders = [onesignal_app_id: "c4fc2f8a-cb3d-4779-8b97-3d605fcd1034",
                                // Project number pulled from dashboard, local value is ignored.
                                onesignal_google_project_number: 'REMOTE']

        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'

    implementation 'com.google.firebase:firebase-database:11.8.0'
    implementation 'com.google.firebase:firebase-storage:11.8.0'
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation 'com.google.firebase:firebase-ads:11.8.0'

    implementation 'com.firebaseui:firebase-ui-database:3.2.1'

    implementation 'com.onesignal:OneSignal:[3.8.1, 3.99.99)'
}
apply plugin: 'com.google.gms.google-services'

构建gradle(项目)

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:4.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我该如何解决这个问题,

我如何一起使用这两个?

我看过一些类似的旧问题,但是我无法解决问题。

1 个答案:

答案 0 :(得分:-1)

这是重复的二进制依赖性的结果。库A已具有库B的二进制文件。删除库B并重建。