我正在尝试在 android studio 中使用 paho Mqtt 的 android 客户端并使用 gradle 添加依赖项,我在应用程序 build.gradle 中使用以下内容:
repositories {
maven {
url "https://repo.eclipse.org/content/repositories/paho-releases/"
}
}
dependencies {
compile('org.eclipse.paho:org.eclipse.paho.android.service:1.0.2') {
exclude module: 'support-v4'
}
}
然而,这让我无法解决错误。我尝试使用 SNAPSHOT 版本(1.0.3,但我遇到了同样的错误。我尝试了与谷歌搜索一样多的脚本,但没有结果。
非常感谢任何帮助。
我的引用是: http://www.hivemq.com/blog/mqtt-client-library-enyclopedia-paho-android-service
这是我的build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.sayres.mqttapp"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven {
url "https://repo.eclipse.org/content/repositories/paho-releases/"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile('org.eclipse.paho:org.eclipse.paho.android.service:1.0.2') {
exclude module: 'support-v4'
}
}
最佳答案
将其从您的app build.gradle 中删除并添加到 project build.gradle by allprojects
repositories {
maven { url "https://repo.eclipse.org/content/repositories/paho-releases/" }
}
关于android - maven paho-releases 不在 gradle 中编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44475190/