android - maven paho-releases 不在 gradle 中编译

标签 android android-gradle-plugin mqtt

我正在尝试在 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/

相关文章:

android - Android中的自定义圆形按钮

android - R.txt' : The data is invalid. (13)

android - 网络无法访问 : connect

java - 使用 MQTT (paho) + activeMQ 接收消息的正确方式是怎样的?

node.js - Nodejs中的mqtt文件传输? (使用 mqtt.js)

android - 我想把图片放在按钮上

android - 为 gridview 获得类似 google currents 的效果

php - 得到????标记为来自 php 的响应,而不是获取泰米尔文本字符串。

android - 如何从 Git 导入 Android Studio 项目

tcp - MQTT:不可靠的交付而不是 TCP