简体   繁体   English

ADT20和外部JAR

[英]ADT20 and External JAR

在此处输入图片说明 I have tried absolutely everything to avoid the NoClassDefFoundError when trying to use an external jar. 在尝试使用外部jar时,我已经尽一切努力避免NoClassDefFoundError。 No dice. 没有骰子。 WTF ADT?! WTF ADT ?!

From a clean, brand new project, add external jar to build path, put in libs folder, make sure it's checked. 从一个干净的全新项目中,添加外部jar来构建路径,放入libs文件夹中,确保已选中它。 Android -> Fix Project Properties, adding and removing, rinsing and repeating. Android->修复项目属性,添加和删除,漂洗和重复。 I checked the contents of the jar, and my files are there! 我检查了罐子的内容,并且文件在那里! I referenced it 20 ways, removed added and rebuilt, still the dern thing can't be found!! 我引用了20种方法,删除了添加的内容并对其进行了重建,但仍然找不到破旧的东西!

Is there a way someone has, from step 1, made an external jar work inside Android using eclipse and ADT 20? 从第1步开始,有人是否有办法使用eclipse和ADT 20在Android内部使外部jar工作?

Edit 1 编辑1

I tried adding it into only the libs/ folder, and tried what Ali suggested in this SO question . 我尝试将其仅添加到libs/文件夹,并尝试了Ali 在此SO问题中提出的建议。 I think I'm going to have to just try and add the source to my project directly, but that seems plain silly. 我想我将不得不尝试直接将源代码添加到我的项目中,但这似乎很愚蠢。

Oh. 哦。 My. 我的。 Goodness. 善良。

Turns out, Android (still) does NOT support Java 7 and when I created my external project, it had the 1.7 (Java 7) as the default compliance level! 事实证明, Android(仍然)不支持Java 7 ,当我创建外部项目时,它的默认遵从级别为1.7(Java 7)! Switching that down to match my Android project's compliance makes it all dandy. 将其切换为与我的Android项目的合规性相匹配的方式使其变得花哨。

Stuff like 像东西

List<MyClass> mList = new ArrayList<>();

And various @Override apparently made Android stick it's nose in the air. 各种@Override显然使Android @Override的作用。

Hopefully this helps someone else out who's been going bald over this issue! 希望这可以帮助在这个问题上变得秃头的其他人!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM