ews-java-api icon indicating copy to clipboard operation
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)

Open FatmaMM opened this issue 5 years ago • 9 comments

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)

FatmaMM avatar Mar 13 '19 13:03 FatmaMM

How do you get this error? In what cases?

pkropachev avatar Mar 15 '19 17:03 pkropachev

I get this error when i import the library as jar file into the project implementation files('libs/ews-java-api-2.0.jar')

FatmaMM avatar Mar 17 '19 09:03 FatmaMM

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'

pkropachev avatar Mar 17 '19 09:03 pkropachev

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)}

FatmaMM avatar Mar 17 '19 12:03 FatmaMM

Can you attach the sample of project which generates such error?

pkropachev avatar Mar 17 '19 18:03 pkropachev

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)

WenqiangTu avatar Sep 03 '19 02:09 WenqiangTu

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

KushtrimPacaj avatar Sep 03 '19 08:09 KushtrimPacaj

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);

xx113355 avatar Jan 26 '21 20:01 xx113355

me too,I have this error,how to resolve it

zhangll2020 avatar Apr 16 '21 07:04 zhangll2020