错误:(52,0)未找到Gradle DSL方法:使用Quickblox API时出现“сompile()" [英] Error:(52, 0) Gradle DSL method not found: 'сompile()' in using Quickblox API

查看:229
本文介绍了错误:(52,0)未找到Gradle DSL方法:使用Quickblox API时出现“сompile()"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过添加在线Maven依赖项在程序中使用Quickblox API. 我正在使用Android Studio.
当我尝试构建程序时,它显示以下错误:

I tried to use Quickblox API in my program by adding online maven dependencies. I'm using Android Studio.
When I tried to build my program, it shows the following error:

错误:(52,0)未找到Gradle DSL方法:`сompile()` 可能的原因:
  • 项目"Nanny Watch"可能正在使用不包含该方法的Gradle版本.
    打开Gradle包装器文件
  • 构建文件可能缺少Gradle插件.
    应用Gradle插件
  • Error:(52, 0) Gradle DSL method not found: `сompile()` Possible causes:
  • The project 'Nanny Watch' may be using a version of Gradle that does not contain the method.
    Open Gradle wrapper file
  • The build file may be missing a Gradle plugin.
    Apply Gradle plugin
  • 这是build.gradle(Project:NannyWatch2)文件:

    Here is the build.gradle(Project:NannyWatch2) file:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:1.5.0'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
    
            jcenter()
        }
    }
    

    这是build.gradle(Module:App)文件:

    And here is the build.gradle(Module:App) file:

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.2"
    
        defaultConfig {
            applicationId "com.example.user.nannywatch"
            minSdkVersion 16
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        def qbSdkVersion = '2.5'
    
        compile fileTree(include: ['*.jar'], dir: 'libs')
        compile 'org.apache.commons:commons-lang3:3.4'
        compile 'net.schmizz:sshj:0.10.0'
        compile 'com.android.support:appcompat-v7:23.1.1'
        compile 'com.android.support:design:23.1.1'
        compile 'com.android.support:multidex:1.0.0'
        compile('vc908.stickers:stickerfactory:0.2.2@aar') {
            transitive = true;
        }
        compile 'com.google.android.gms:play-services-gcm:7.5.0'  
    
    // I tried using jar compile, but the method QBPushNotifications cannot be resolved
    // Therefore I tried to use the online repository
    
    //    compile files('src/main/java/com/example/user/nannywatch/jars/quickblox-android-sdk-chat-2.4.jar')
    //    compile files('src/main/java/com/example/user/nannywatch/jars/quickblox-android-sdk-content-2.4.jar')
    //    compile files('src/main/java/com/example/user/nannywatch/jars/quickblox-android-sdk-core-2.4.jar')
    //    compile files('src/main/java/com/example/user/nannywatch/jars/quickblox-android-sdk-customobjects-2.4.jar')
    //    compile files('src/main/java/com/example/user/nannywatch/jars/quickblox-android-sdk-location-2.4.jar')
    //    compile files('src/main/java/com/example/user/nannywatch/jars/quickblox-android-sdk-messages-2.4.jar')
    //    compile files('src/main/java/com/example/user/nannywatch/jars/quickblox-android-sdk-videochat-webrtc-2.4.jar')  
    
        сompile "com.quickblox:quickblox-android-sdk-core:$qbSdkVersion@aar"
        сompile ("com.quickblox:quickblox-android-sdk-chat:$qbSdkVersion@aar"){
            transitive=true
        }
        сompile "com.quickblox:quickblox-android-sdk-content:$qbSdkVersion@aar"
        сompile "com.quickblox:quickblox-android-sdk-messages:$qbSdkVersion@aar"
        сompile "com.quickblox:quickblox-android-sdk-customobjects:$qbSdkVersion@aar"
        сompile "com.quickblox:quickblox-android-sdk-location:$qbSdkVersion@aar"
        сompile "com.quickblox:quickblox-android-sdk-videochat-webrtc:$qbSdkVersion@aar"
    }
    

    也有此警告:'dependencies'不能应用于'(groovy.lang.Closure)' 图片

    There is also this warning: 'dependencies' cannot be applied to '(groovy.lang.Closure)' Image

    推荐答案

    这是一个非常奇怪的错误".当您从 Quickblox 复制并粘贴Gradle行时,您复制了错误的ASCII代码编译中的字母"c"中的字母,Gradle不能识别单词编译".

    This is a very strange "bug". When you copied and pasted the Gradle lines from Quickblox, you copied a wrong ASCII code of the letter "c" in the word compile and Gradle would not recognize the word "compile".

    • 从Quickblox网站复制的ASCII代码"c"为209129
    • "c"的ASCII码是99

    您可以使用以下链接自行尝试:字符串转换为ASCII

    You can try it yourself using this link: string to ASCII

    • 常规字母→c
    • Quickblox字母→с

    转换每个字母,您将获得一个不同的ASCII码.

    Convert each letter and you will get a different ASCII code.

    因此,解决方案非常简单,删除字母c并自己编写:)

    So the solution is very simple, delete the letter c and write it yourself :)

    这篇关于错误:(52,0)未找到Gradle DSL方法:使用Quickblox API时出现“сompile()"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆