Reputation: 41
I am simply not able to bring the PAHO / Eclipse MQTT Android Service into an Android Studio project. It says "A problem occurred evaluating project ':app'." I have added the required dependencies in the build.gragle(module) file. Bellow, I will add the full build.gradle file. including the full error.
plugins {
id 'com.android.application'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.mqqttestapp"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
maven {
url "https://repo.eclipse.org/content/repositories/paho-snapshots/"
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.0'
implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
}
error
Build file 'C:\Users\*****\MQQTtestApp\app\build.gradle' line: 30
A problem occurred evaluating project ':app'.
> Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'app\build.gradle'
Upvotes: 0
Views: 499
Reputation: 41
GOTO settings.gradle and replace
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
with
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
That installed MQTT lib into my project.
Upvotes: 1