macos Android 更新 17 似乎与外部 Jars 不兼容
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10046298/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android update 17 seems incompatible with external Jars
提问by Yevgeny Simkin
I just allowed my Mac to do an update on its Java installation and now some of my old jars (like javax.mail
and apache.commons.httpclient
) are throwing "class not found"exceptions at run time!
我只是允许我的 Mac 对其 Java 安装进行更新,现在我的一些旧 jar(如javax.mail
和apache.commons.httpclient
)在运行时抛出“找不到类”异常!
Meaning, they compile fine, but then crash at run time with exceptions that look like this:
意思是,它们编译良好,但在运行时崩溃,异常如下所示:
E/dalvikvm(2414): Could not find class 'javax.mail.internet.InternetAddress', referenced from method com.my.project.Main.isValidEmailAddress
Do I need to get more recent versions of the jars that have those classes? Or do I need to revert to my previous version of Java?
我是否需要获得具有这些类的 jar 的更新版本?或者我需要恢复到我以前的 Java 版本吗?
Or is this some totally unrelated problem that I'm just assuming has to do with the Java update (would be quite a coincidence, all of this worked perfectly prior to the update)?
或者这是一些完全不相关的问题,我只是假设与 Java 更新有关(这完全是巧合,所有这些在更新之前都运行良好)?
回答by MAC
crash at run time with exceptions that look like this:
Could not find class 'javax.mail.internet.InternetAddress', referenced from method com.my.project.Main.isValidEmailAddress
运行时崩溃,异常如下所示:
Could not find class 'javax.mail.internet.InternetAddress', referenced from method com.my.project.Main.isValidEmailAddress
If you have problems with external jars, then:
如果您在使用外部 jar 时遇到问题,则:
- create a folder named
libs
. - Copy and paste all needed external jar files into that folder.
- 创建一个名为
libs
. - 将所有需要的外部 jar 文件复制并粘贴到该文件夹中。
It will automatically be included, as explained on this page: Dealing with dependencies in Android projects
它将自动包含在内,如本页所述:处理 Android 项目中的依赖项
回答by Mike
Same thing happened to me but my folder was labeled "lib" instead of "libs" arg! updating was a little rough this time around... fixed after removing the external jars from the project settings and changing the folder to libs
同样的事情发生在我身上,但我的文件夹被标记为“lib”而不是“libs”arg!这次更新有点粗糙……在从项目设置中删除外部 jar 并将文件夹更改为 libs 后修复