ews-java-api
ews-java-api copied to clipboard
java.lang.NoSuchFieldError: No field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; in class Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; or its superclasses (declaration of 'org.apache.http.conn.ssl.AllowAllHostnameVerifier' appears in /system/framework/framework.jar:classes2.dex)
this error i don't how to solve it ?? java.lang.NoSuchFieldError: No field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; in class Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; or its superclasses (declaration of 'org.apache.http.conn.ssl.AllowAllHostnameVerifier' appears in /system/framework/framework.jar:classes2.dex)
How do you get this error? In what cases?
I get this error when i import the library as jar file into the project implementation files('libs/ews-java-api-2.0.jar')
EWS Java API has his own dependencies. Are sure that your declaration of dependencies is correct? In my case all is ok.
plugins {
// Apply the java plugin to add support for Java
id 'java'
// Apply the application plugin to add support for building an application
id 'application'
}
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
dependencies {
implementation 'com.microsoft.ews-java-api:ews-java-api:2.0'
}
// Define the main class for the application
mainClassName = 'ews.gradle.App'
yes. But when i add ((implementation 'com.microsoft.ews-java-api:ews-java-api:2.0')) i get this error :Program type already present: microsoft.exchange.webservices.data.ISelfValidate Message{kind=ERROR, text=Program type already present: microsoft.exchange.webservices.data.ISelfValidate, sources=[Unknown source file], tool name=Optional.of(D8)}
Can you attach the sample of project which generates such error?
I have same error,just create a new project use android sutdio 3.5
implementation 'com.microsoft.ews-java-api:ews-java-api:2.0'
after build show error 'More than one file was found with OS independent path 'META-INF/DEPENDENCIES''
then i add
packagingOptions { exclude 'META-INF/DEPENDENCIES' }
in app/build.gradle,and build success
add code in guide and run,then show error
java.lang.NoSuchFieldError: No field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; in class Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; or its superclasses (declaration of 'org.apache.http.conn.ssl.AllowAllHostnameVerifier' appears in /system/framework/framework.jar:classes2.dex)
Android ( AOSP ), has the same file ( org/apache/http/conn/ssl/AllowAllHostnameVerifier ) in framework.jar , and it doesn't contain the INSTANCE field: http://androidxref.com/7.1.2_r36/xref/frameworks/base/core/java/org/apache/http/conn/ssl/AllowAllHostnameVerifier.java
Unfortunately this takes precedence to the app version, and this is what is used in runtime. So you get a runtime error.
As far as I understand, the only way to solve this would be to change the signature of the app lib versions, for example org/apache-android/http/conn/ssl/AllowAllHostnameVerifier, so as not to clash with the system ones.
Seems like someone already did this: https://github.com/alipov/ews-android-api
I also have this error.
Caused by: java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; in class Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier
Code: ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
me too,I have this error,how to resolve it