Android - Apache 公共库和Exchange Web 服务托管 API
我已经在尝试 Java 中的交换 Web 服务。运行良好。它已正确发送电子邮件或接收电子邮件。
我的java代码如下所示:
public static void main(String[] args) {
try {
Locale.setDefault(Locale.ENGLISH);
ExchangeService service = new ExchangeService();
WebCredentials webCredentials = new WebCredentials("[email protected]", "asdasdasd");
URI url = new URI("https://asdasd802.outlook.com/ews/Exchange.asmx");
service.setCredentials(webCredentials);
service.setUrl(url);
System.out.println(service.getRequestedServerVersion());
msg.setSubject("Hello world!");
msg.setBody(MessageBody.getMessageBodyFromText("Sent using the EWS Managed API."));
msg.getToRecipients().add("[email protected]");
msg.send();
} catch (Exception ex) {
ex.printStackTrace();
//System.out.println(ex.toString());
}
}
当我在android中使用此代码尝试此操作时:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_layout);
Button b = (Button) findViewById(R.id.button1);
b.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Locale.setDefault(Locale.ENGLISH);
try {
ExchangeService service = new ExchangeService();
WebCredentials webCredentials = new WebCredentials(
"[email protected]",
"asdasd");
URI url = new URI("https://asdasd.outlook.com/ews/Exchange.asmx");
service.setCredentials(webCredentials);
service.setUrl(url);
EmailMessage msg= new EmailMessage(service);
msg.setSubject("Hello world!");
msg.setBody(MessageBody.getMessageBodyFromText
("Sent using the EWS Managed API."));
msg.getToRecipients().add("[email protected]");
msg.send();
} catch (Exception ex) {
//ex.printStackTrace();
System.out.println(ex.toString());
}
}
});
}
单击按钮时出现一些错误。
这是来自控制台的消息:
[2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.httpclient.HttpMethodBase$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.impl.LogFactoryImpl$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.impl.LogFactoryImpl$2) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.impl.LogFactoryImpl$3) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.impl.SimpleLog$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.impl.WeakHashtable$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$2) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$3) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$4) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$5) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$6) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. Toggle HighlightingOpen in New WindowSelect All
这是来自日志聊天的错误:
09-21 09:10:17.039: E/AndroidRuntime(4126): FATAL EXCEPTION: main 09-21 09:10:17.039: E/AndroidRuntime(4126): java.lang.VerifyError: microsoft.exchange.webservices.data.EwsServiceXmlWriter 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.ServiceRequestBase.emit(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.ServiceRequestBase.validateAndEmitRequest(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.SimpleServiceRequestBase.internalExecute(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.MultiResponseServiceRequest.execute(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.ExchangeService.internalCreateItems(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.ExchangeService.createItem(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.Item.internalCreate(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.EmailMessage.internalSend(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.EmailMessage.send(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at com.MobileApplication1.android.MainScreenActivity$1.onClick(MainScreenActivity.java:60) 09-21 09:10:17.039: E/AndroidRuntime(4126): at android.view.View.performClick(View.java:2485) 09-21 09:10:17.039: E/AndroidRuntime(4126): at android.view.View$PerformClick.run(View.java:9080) 09-21 09:10:17.039: E/AndroidRuntime(4126): at android.os.Handler.handleCallback(Handler.java:587) 09-21 09:10:17.039: E/AndroidRuntime(4126): at android.os.Handler.dispatchMessage(Handler.java:92) 09-21 09:10:17.039: E/AndroidRuntime(4126): at android.os.Looper.loop(Looper.java:123) 09-21 09:10:17.039: E/AndroidRuntime(4126): at android.app.ActivityThread.main(ActivityThread.java:3687) 09-21 09:10:17.039: E/AndroidRuntime(4126): at java.lang.reflect.Method.invokeNative(Native Method) 09-21 09:10:17.039: E/AndroidRuntime(4126): at java.lang.reflect.Method.invoke(Method.java:507) 09-21 09:10:17.039: E/AndroidRuntime(4126): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) 09-21 09:10:17.039: E/AndroidRuntime(4126): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) 09-21 09:10:17.039: E/AndroidRuntime(4126): at dalvik.system.NativeStart.main(Native Method) Toggle HighlightingOpen in New WindowSelect All
我已经添加了这些库。
Exchange Web 服务 (EWS) Java 托管 API 由单个包 microsoft.exchange.webservices.data 组成,并需要以下第 3 方库
- Apache Commons HttpClient (commons-httpclien.jar)
- Apache Commons Codec (commons-codec.jar)
- Apache Commons 日志记录 (commons-codec.jar)
- JCIFS (jcifs.jar)
- EWS Java API。
问题是什么?
我做了一些研究。 我看到 Android 的 sdk 库中已经有日志记录和 httpclient 了。
I am already trying the exchange web service in Java. It's running good. It has send email or get emails correctly.
My java code looks like this :
public static void main(String[] args) {
try {
Locale.setDefault(Locale.ENGLISH);
ExchangeService service = new ExchangeService();
WebCredentials webCredentials = new WebCredentials("[email protected]", "asdasdasd");
URI url = new URI("https://asdasd802.outlook.com/ews/Exchange.asmx");
service.setCredentials(webCredentials);
service.setUrl(url);
System.out.println(service.getRequestedServerVersion());
msg.setSubject("Hello world!");
msg.setBody(MessageBody.getMessageBodyFromText("Sent using the EWS Managed API."));
msg.getToRecipients().add("[email protected]");
msg.send();
} catch (Exception ex) {
ex.printStackTrace();
//System.out.println(ex.toString());
}
}
When I try this in android with this code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_layout);
Button b = (Button) findViewById(R.id.button1);
b.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Locale.setDefault(Locale.ENGLISH);
try {
ExchangeService service = new ExchangeService();
WebCredentials webCredentials = new WebCredentials(
"[email protected]",
"asdasd");
URI url = new URI("https://asdasd.outlook.com/ews/Exchange.asmx");
service.setCredentials(webCredentials);
service.setUrl(url);
EmailMessage msg= new EmailMessage(service);
msg.setSubject("Hello world!");
msg.setBody(MessageBody.getMessageBodyFromText
("Sent using the EWS Managed API."));
msg.getToRecipients().add("[email protected]");
msg.send();
} catch (Exception ex) {
//ex.printStackTrace();
System.out.println(ex.toString());
}
}
});
}
I get some errors, when clicking on button.
This is the messages from the console :
[2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.httpclient.HttpMethodBase$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.impl.LogFactoryImpl$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.impl.LogFactoryImpl$2) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.impl.LogFactoryImpl$3) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.impl.SimpleLog$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.impl.WeakHashtable$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$2) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$3) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$4) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$5) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$6) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. Toggle HighlightingOpen in New WindowSelect All
This is the errors from log chat:
09-21 09:10:17.039: E/AndroidRuntime(4126): FATAL EXCEPTION: main 09-21 09:10:17.039: E/AndroidRuntime(4126): java.lang.VerifyError: microsoft.exchange.webservices.data.EwsServiceXmlWriter 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.ServiceRequestBase.emit(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.ServiceRequestBase.validateAndEmitRequest(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.SimpleServiceRequestBase.internalExecute(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.MultiResponseServiceRequest.execute(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.ExchangeService.internalCreateItems(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.ExchangeService.createItem(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.Item.internalCreate(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.EmailMessage.internalSend(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.EmailMessage.send(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at com.MobileApplication1.android.MainScreenActivity$1.onClick(MainScreenActivity.java:60) 09-21 09:10:17.039: E/AndroidRuntime(4126): at android.view.View.performClick(View.java:2485) 09-21 09:10:17.039: E/AndroidRuntime(4126): at android.view.View$PerformClick.run(View.java:9080) 09-21 09:10:17.039: E/AndroidRuntime(4126): at android.os.Handler.handleCallback(Handler.java:587) 09-21 09:10:17.039: E/AndroidRuntime(4126): at android.os.Handler.dispatchMessage(Handler.java:92) 09-21 09:10:17.039: E/AndroidRuntime(4126): at android.os.Looper.loop(Looper.java:123) 09-21 09:10:17.039: E/AndroidRuntime(4126): at android.app.ActivityThread.main(ActivityThread.java:3687) 09-21 09:10:17.039: E/AndroidRuntime(4126): at java.lang.reflect.Method.invokeNative(Native Method) 09-21 09:10:17.039: E/AndroidRuntime(4126): at java.lang.reflect.Method.invoke(Method.java:507) 09-21 09:10:17.039: E/AndroidRuntime(4126): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) 09-21 09:10:17.039: E/AndroidRuntime(4126): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) 09-21 09:10:17.039: E/AndroidRuntime(4126): at dalvik.system.NativeStart.main(Native Method) Toggle HighlightingOpen in New WindowSelect All
I already add these libraries.
The Exchange Web Services (EWS) Java Managed API consists of a single package, microsoft.exchange.webservices.data and requires the following 3rd party libraries
- Apache Commons HttpClient (commons-httpclien.jar)
- Apache Commons Codec (commons-codec.jar)
- Apache Commons Logging (commons-codec.jar)
- JCIFS (jcifs.jar)
- EWS Java api.
What is the problem?
I have done some research.
I see some where Android already have logging and httpclient in sdk libraries.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

Ansdroid 已经包含 commons-http (不确定使用哪个版本,但它是 4 或更好),因此您必须确保您的构建过程不会将已经包含的 jar 打包到 apk 中。
另一个问题是 DX 的类格式投诉 - 正如它所说,它已经过时并且必须重新编译。另外,检查您的依赖版本,并使用最新的版本
(如果你使用maven/ivy会更容易)
Ansdroid already contains commons-http (not sure which version is used, but it is 4 or better), so you have to ensure that your build process does not pack aleready contained jars into apk.
Another issue is class format complaint of DX - as it says, it is outdated and has to be recompiled. Also, check your dependency versions, and use recent ones
( if you would use maven / ivy it would be easier )