android studio asks me for a class that is supposedly in a jar, but can not find it I have a class with the following imports:
import com.google.gson.*;
import com.sun.net.httpserver.*;
import java.io.*;
import java.net.*;
import java.nio.charset.*;
import java.nio.file.*;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
In the build.gradle I have the following
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "bfhsoftware.sonidoambiental"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '26.0.2'
}
repositories {
maven { url 'https://mvnrepository.com/artifact/com.sun.net.httpserver/http' }
maven { url 'https://mvnrepository.com/artifact/com.sun/tools' }
}
dependencies {
compile 'com.sun.net.httpserver:http:20070405'
compile 'com.sun:tools:1.7.0.13'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation files('lib/Sonidoambiental-1.2-jar-with-dependencies.jar')
compileOnly files('tools-1.7.0.13.jar')
}
and it gives me the following error:
...
Caused by: java.lang.ClassNotFoundException: Didn't find class "sun.misc.Service" on path: DexPathList[[zip file
...
"sun.misc.service" for what I understand belongs to sun.misc.tools that is in the dependencies, but I do not understand why it does not take it !! I have added by maven and the file tools-1.7.0.13.jar, I do not understand why it does not take it, does anyone know why it can be? thanks