gpt4 book ai didi

java - 错误 :(52, 0) 未找到 Gradle DSL 方法:使用 Quickblox API 时为 'сompile()'

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:27:24 25 4
gpt4 key购买 nike

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

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) 文件:

    // 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) 文件:

    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' cannot be applied to '(groovy.lang.Closure)' Image

    最佳答案

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

    • 从 Quickblox 站点复制的“c”的 ASCII 码是 209 129
    • “c”的ASCII码是99

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

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

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

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

    关于java - 错误 :(52, 0) 未找到 Gradle DSL 方法:使用 Quickblox API 时为 'сompile()',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35415847/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com