android 添加 java 库会导致运行时出错?

android adding a java library causes errors in runtime?

我正在尝试将 this library 添加到 android 工作室中的 android 应用程序。当我通过 jar 添加它时,它不会给我错误,它会尝试构建但永远不会完成。当我尝试通过 gradle 添加它时 编译 "org.telegram:telegrambots:3.0.1" 它会构建但给了我一些运行时错误:

AGPBI: {"kind":"error","text":"Lambda coming from jar file need their 
interfaces on the classpath to be compiled, unknown interfaces are 
java.util.function.Predicate","sources":
[{"file":"C:\Users\soshiant\AndroidStudioProjects\Glassbutton3\ 
DefaultBotSession.java","position":{"startLine":215,"endLine":216}}]} AGPBI:     
{"kind":"error","text":"Lambda coming from jar file need their interfaces on 
the classpath to be compiled, unknown interfaces are 
java.util.function.Function","sources":
[{"file":"C:\Users\soshiant\AndroidStudioProjects\Glassbutton3\ 
DefaultBotSession.java","position":{"startLine":216,"endLine":217}}]} AGPBI: 
{"kind":"error","text":"Lambda coming from jar file need their interfaces on 
the classpath to be compiled, unknown interfaces are 
java.util.Comparator","sources":
[{"file":"C:\Users\soshiant\AndroidStudioProjects\Glassbutton3\ 
DefaultBotSession.java","position":{"startLine":217,"endLine":218}}]}

我不知道它是否相关,但构建它会发出这样的警告:

WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.5.3 is 
ignored for release as it may be conflicting with the internal version 
provided by Android. In case of problem, please repackage it with jarjar to 
change the class packages WARNING: WARNING: Dependency org.json:json:20160810 
is ignored for release as it may be conflicting with the internal version 
provided by Android. In case of problem, please repackage it with jarjar to 
change the class packages

该项目是一个空的 activity,其中没有任何代码,只是添加了库。 我以前在 Java 程序中使用过这个库,它运行得非常完美。 我不知道我在添加这个时做错了什么library.i我已经尝试了 sdkbuild 版本和 targetsdk 的多种组合但无济于事。

我也尝试过这个库的不同版本,它给了我类似的错误。

TelegramBots 需要 java 8.

Android 支持 java 8 但不完全。您可以在此处查看支持的内容以及如何启用 java8 支持:https://developer.android.com/studio/preview/features/java8-support.html

即使 android 支持目前 TelegramBots 中的所有功能,您也不知道将来是否会添加任何不受支持的功能,因此我不会在 [=18] 中使用此库=] 项目.