Gradle“找不到参数的方法сompile()”,设置Quickblox

时间:2017-01-26 17:00:08

标签: java android gradle quickblox

大家好!我是android的新手,我浪费了一天,寻找解决方案。我在我的应用程序中添加了Quickblox GCM,当我尝试构建项目时,Gradle说:

  

错误:(71,1)评估项目':app'时出现问题。   无法在类型为org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler的对象上找到参数[com.quickblox:quickblox-android-sdk-chat:3.3.0]的方法сompile()。

这是我的app / gradle.build:

> buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    //Crashlytics
    maven { url 'https://maven.fabric.io/public'
    }
    //Mockito
    jcenter()
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:design:25.1.0'

//Crashlytics
compile ('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
    transitive = true;
}

// Retrofit
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'

//RxAndroid
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'

//Quickblox
сompile "com.quickblox:quickblox-android-sdk-chat:$rootProject.qbSdkVersion"
сompile "com.quickblox:quickblox-android-sdk-messages:$rootProject.qbSdkVersion"

这是root gradle.build:

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

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

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://github.com/QuickBlox/quickblox-android-sdk-releases/raw/master/"
        }
    }
}

ext {
    qbSdkVersion = '3.3.0'
}

由于http://quickblox.com/developers/Android#How_to:_add_SDK_to_IDE_and_connect_to_the_cloud

的指示,我做了所有这些

1 个答案:

答案 0 :(得分:4)

替换

сompile "com.quickblox:quickblox-android-sdk-chat:$rootProject.qbSdkVersion"
сompile "com.quickblox:quickblox-android-sdk-messages:$rootProject.qbSdkVersion"

使用

compile("com.quickblox:quickblox-android-sdk-chat:2.6.1")