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

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

问题描述

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

<块引用>错误:(52, 0) 找不到 Gradle DSL 方法:`сcompile()`可能的原因:
  • Nanny Watch"项目可能正在使用不包含该方法的 Gradle 版本.
    打开 Gradle 包装文件
  • 构建文件可能缺少 Gradle 插件.
    应用 Gradle 插件
  • 这是 build.gradle(Project:NannyWatch2) 文件:

    //顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项.构建脚本{存储库{jcenter()}依赖{类路径 'com.android.tools.build:gradle:1.5.0'//注意:不要将您的应用程序依赖项放在这里;他们属于//在单独的模块 build.gradle 文件中}}所有项目{存储库{jcenter()}}

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

    应用插件:'com.android.application'安卓 {compileSdkVersion 23构建工具版本23.0.2"默认配置{applicationId "com.example.user.nannywatch"minSdk 版本 16目标SDK版本23版本代码 1版本名称1.0"multiDexEnabled true}构建类型{释放 {minifyEnabled falseproguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'}}}依赖{def qbSdkVersion = '2.5'编译文件树(包括:['*.jar'],目录:'libs')编译'org.apache.commons:commons-lang3:3.4'编译'net.schmizz:sshj:0.10.0'编译'com.android.support:appcompat-v7:23.1.1'编译'com.android.support:design:23.1.1'编译'com.android.support:multidex:1.0.0'编译('vc908.stickers:stickerfactory:0.2.2@aar'){传递 = 真;}编译 'com.google.android.gms:play-services-gcm:7.5.0'//我尝试使用jar compile,但是方法QBPushNotifications 无法解析//因此我尝试使用在线存储库//编译文件('src/main/java/com/example/user/nannywatch/jars/quickblox-android-sdk-chat-2.4.jar')//编译文件('src/main/java/com/example/user/nannywatch/jars/quickblox-android-sdk-content-2.4.jar')//编译文件('src/main/java/com/example/user/nannywatch/jars/quickblox-android-sdk-core-2.4.jar')//编译文件('src/main/java/com/example/user/nannywatch/jars/quickblox-android-sdk-customobjects-2.4.jar')//编译文件('src/main/java/com/example/user/nannywatch/jars/quickblox-android-sdk-location-2.4.jar')//编译文件('src/main/java/com/example/user/nannywatch/jars/quickblox-android-sdk-messages-2.4.jar')//编译文件('src/main/java/com/example/user/nannywatch/jars/quickblox-android-sdk-videochat-webrtc-2.4.jar')с编译com.quickblox:quickblox-android-sdk-core:$qbSdkVersion@aar"сompile ("com.quickblox:quickblox-android-sdk-chat:$qbSdkVersion@aar"){传递=真}с编译com.quickblox:quickblox-android-sdk-content:$qbSdkVersion@aar"с编译com.quickblox:quickblox-android-sdk-messages:$qbSdkVersion@aar"с编译com.quickblox:quickblox-android-sdk-customobjects:$qbSdkVersion@aar"с编译com.quickblox:quickblox-android-sdk-location:$qbSdkVersion@aar"с编译com.quickblox:quickblox-android-sdk-videochat-webrtc:$qbSdkVersion@aar"}

    还有这个警告:'dependencies' cannot be applied to '(groovy.lang.Closure)'图片

    解决方案

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

    • 从 Quickblox 站点复制的c"的 ASCII 代码是 209 129
    • c"的ASCII码是99

    您可以使用此链接自己尝试:string to ASCII

    • 普通字母 → c
    • Quickblox 信件 → с

    转换每个字母,你会得到不同的 ASCII 码.

    所以解决方法很简单,把字母c删掉,自己写:)

    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:

    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
  • 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()
        }
    }
    

    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"
    }
    

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

    解决方案

    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".

    • the ASCII code of "c" copied from Quickblox site is 209 129
    • the ASCII code of "c" is 99

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

    • regular letter → c
    • Quickblox letter → с

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

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

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

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