sayres kabir
sayres kabir

Reputation: 362

maven paho-releases doesn't compile in gradle

I'm trying to use paho Mqtt's android client in android studio and using gradle to add dependencies, I use the following in app 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'
}
}

yet this is giving me failed to resolve error.I tried with SNAPSHOT version (1.0.3 and I got the same error. I've tried as many scripts as googling yielded to no result.

any help is greatly appreciated.

my refrence is : http://www.hivemq.com/blog/mqtt-client-library-enyclopedia-paho-android-service

this is my 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'
}
}

Upvotes: 1

Views: 368

Answers (1)

Ludy Astra-Germany
Ludy Astra-Germany

Reputation: 131

Remove this from your app build.gradle and added to project build.gradle by allprojects

repositories {
    maven { url "https://repo.eclipse.org/content/repositories/paho-releases/" }
}

Upvotes: 1

Related Questions