我尝试通过添加在线 Maven 依赖项在我的程序中使用 Quickblox API。
我正在使用 Android Studio。
当我尝试构建我的程序时,它显示以下错误:
Error:(52, 0) Gradle DSL method not found: `сompile()`
Possible causes:项目“Nanny Watch”可能使用不包含该方法的 Gradle 版本。
打开 Gradle 包装文件
构建文件可能缺少 Gradle 插件。
应用 Gradle 插件
这是 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"
}
还有这个警告:“依赖项”不能应用于“(groovy.lang.Closure)”Image https://i.stack.imgur.com/hk4cD.png
这是一个非常奇怪的“bug”。当您复制并粘贴 Gradle 行时快速布洛克斯 https://github.com/QuickBlox/quickblox-android-sdk-releases,您在“compile”一词中复制了错误的字母“c”的 ASCII 代码,Gradle 将无法识别“compile”一词。
- 从 Quickblox 站点复制的“c”的 ASCII 代码是 209 129
- “c”的 ASCII 代码是 99
您可以使用此链接自行尝试:字符串转 ASCII http://www.unit-conversion.info/texttools/ascii/
- 常规字母 → c
- Quickblox 字母 → с
转换每个字母,您将得到不同的 ASCII 代码。
所以解决办法很简单,把c字母删掉,自己写:)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)