alipov / ews-android-api

ews-java-api library packaged for Android. For API details see https://github.com/OfficeDev/ews-java-api.
50 stars 27 forks source link

Error when use auto discover url #26

Closed WenqiangTu closed 5 years ago

WenqiangTu commented 5 years ago

When i use code in start guide,set url by auto discover,it shows error


java.lang.NoClassDefFoundError: Failed resolution of: Ljava/applet/Applet;
        at com.sun.naming.internal.ResourceManager.getInitialEnvironment(ResourceManager.java:126)
        at android.javax.naming.InitialContext.init(InitialContext.java:222)
        at android.javax.naming.InitialContext.<init>(InitialContext.java:202)
        at android.javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:87)
        at microsoft.exchange.webservices.data.dns.DnsClient.dnsQuery(DnsClient.java:79)
        at microsoft.exchange.webservices.data.autodiscover.AutodiscoverDnsClient.findBestMatchingSrvRecord(AutodiscoverDnsClient.java:129)
        at microsoft.exchange.webservices.data.autodiscover.AutodiscoverDnsClient.findAutodiscoverHostFromSrv(AutodiscoverDnsClient.java:102)
        at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.getRedirectionUrlFromDnsSrvRecord(AutodiscoverService.java:767)
        at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.getSettings(AutodiscoverService.java:1180)
        at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.getUserSettings(AutodiscoverService.java:1044)
        at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.internalGetSoapUserSettings(AutodiscoverService.java:988)
        at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.getUserSettings(AutodiscoverService.java:1851)
        at microsoft.exchange.webservices.data.core.ExchangeService.getAutodiscoverUrl(ExchangeService.java:3616)
        at microsoft.exchange.webservices.data.core.ExchangeService.autodiscoverUrl(ExchangeService.java:3541)
        at jhd.unreadmails4outlook_android.email.outlook.OutlookConnector.connect2Email(OutlookConnector.java:61)
        at jhd.unreadmails4outlook_android.ui.MainActivity$2.run(MainActivity.java:91)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "java.applet.Applet" on path: DexPathList[[zip file "/data/app/jhd.unreadmails4outlook_android-iquFrqKaEG1ks8Bgj4IFTg==/base.apk"],nativeLibraryDirectories=[/data/app/jhd.unreadmails4outlook_android-iquFrqKaEG1ks8Bgj4IFTg==/lib/x86, /system/lib, /vendor/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at com.sun.naming.internal.ResourceManager.getInitialEnvironment(ResourceManager.java:126) 
        at android.javax.naming.InitialContext.init(InitialContext.java:222) 
        at android.javax.naming.InitialContext.<init>(InitialContext.java:202) 
        at android.javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:87) 
        at microsoft.exchange.webservices.data.dns.DnsClient.dnsQuery(DnsClient.java:79) 
        at microsoft.exchange.webservices.data.autodiscover.AutodiscoverDnsClient.findBestMatchingSrvRecord(AutodiscoverDnsClient.java:129) 
        at microsoft.exchange.webservices.data.autodiscover.AutodiscoverDnsClient.findAutodiscoverHostFromSrv(AutodiscoverDnsClient.java:102) 
        at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.getRedirectionUrlFromDnsSrvRecord(AutodiscoverService.java:767) 
        at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.getSettings(AutodiscoverService.java:1180) 
        at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.getUserSettings(AutodiscoverService.java:1044) 
        at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.internalGetSoapUserSettings(AutodiscoverService.java:988) 
        at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.getUserSettings(AutodiscoverService.java:1851) 
        at microsoft.exchange.webservices.data.core.ExchangeService.getAutodiscoverUrl(ExchangeService.java:3616) 
        at microsoft.exchange.webservices.data.core.ExchangeService.autodiscoverUrl(ExchangeService.java:3541) 
        at jhd.unreadmails4outlook_android.email.outlook.OutlookConnector.connect2Email(OutlookConnector.java:61) 
        at jhd.unreadmails4outlook_android.ui.MainActivity$2.run(MainActivity.java:91) ```
alipov commented 5 years ago

@WenqiangTu Your stack trace suggests that you haven't run the build steps properly.

How do I know that?

    at android.javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:87) 
    at microsoft.exchange.webservices.data.dns.DnsClient.dnsQuery(DnsClient.java:79)

DnsClient#dnsQuery calls InitialDirContext constructor at line 79, which only happens in ews-java-api's original DnsClient class. This class is being excluded and replaced with a patched one.

Please let me know if you have any other issues.