I am very new to Android studio and I am modifying a project for MQTT for io.adafruit. I was getting a warning about chrome not being able to load so I tried to update it and in so doing updated Android Studio and then started changing some suggested warnings. Now I get the following error and nothing will work.
Provider for class java.xml parser.DocumentBuilderFactory cannot be created. I have tried deleting Android Studio as well as the SDK and tried to reinstall them without much luck.
Here in my build.gradle(Project
buildscript {
ext.kotlin_version = '1.5.21'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and my build.gradle(Module
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 33
defaultConfig {
applicationId "com.example.mqttkotlinsample"
minSdkVersion 16
targetSdkVersion 33
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
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
//this says the kotlin library and plug-in versions are different. I'm not sure how to rectify this. HELP
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.7.10"
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.2'
//this says to replace with specific version but I don't know what one to use. HELP testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.4'
implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
}
here is my build file
Build file '/Users/garywaynebenna/AndroidStudioProjects/MQTTClientSample_Android-master/app/build.gradle' line: 2
An exception occurred applying plugin request [id: 'com.android.application']
Failed to apply plugin class 'org.gradle.api.plugins.JavaBasePlugin'. Cannot create service of type JavaToolchainQueryService using JavaToolchainQueryService constructor as there is a problem with parameter #1 of type JavaInstallationRegistry. ... 274 more Caused by: java.lang.RuntimeException: Provider for class javax.xml.parsers.DocumentBuilderFactory cannot be created ... 279 more Caused by: java.util.ServiceConfigurationError: javax.xml.parsers.DocumentBuilderFactory: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found ... 279 more
I would really really appreciate some help with this.