firebase jobdispatcher-我无法添加依赖项

时间:2017-12-14 15:34:18

标签: android android-studio firebase gradle

我有问题为firebase jobdispatcher添加依赖项,我在gradle文件中来回试用,我已经在我的android SDK中安装了Google Play服务,但仍然无法编译这种依赖性。

这是我的gradle文件-app level

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.android.project"

        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dataBinding.enabled = true
}

repositories {
    mavenCentral()
    maven {url "https://clojars.org/repo/"}
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:26.0.1'

    compile 'com.android.support:recyclerview-v7:26.0.1'
    compile 'com.android.support:preference-v7:26.0.1'

    compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'

    compile 'com.firebase:firebase-jobdispatcher:0.5.2'
}

和这里的项目级别

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'



    }
}

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

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

1 个答案:

答案 0 :(得分:0)

buildscript {

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

    }
}

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

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

在项目级build.gradle

中尝试此操作