1

我正在使用 java 1.7 在 win 7 x64 上使用 3 天前的 adt 17 下载。

将 jar 添加到我的新示例项目(通过将其复制到 libs/)编译正常,但在运行时抛出,因为 jar 中的类不在 dexedlibs/ 中的相应 jar 中 - 该 jar 仅包含一个清单。

相关链接:http ://android.foxykeep.com/dev/how-to-fix-the-classdefnotfounderror-with-adt-17和http://tools.android.com/recent/dealingwithdependenciesinandroidprojects

做一些链接中建议的出口和订购的东西并没有帮助。

这些天人们怎么知道如何将 jar 添加到 android 项目中?

编辑:感谢 max:jar 是使用 java 1.7 制作的,指定 1.6 停止了投掷,但由于某种原因,我仍然得到一些缺少的方法(这些没有被调用,但它们被引用)。

12-20 23:02:13.689: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 
12-20 23:02:13.689: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0
12-20 23:02:13.689: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0
12-20 23:02:13.949: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0
12-20 23:02:13.949: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0
12-20 23:02:14.829: I/dalvikvm(27907): Could not find method com.tayek.utilities.Utilities.store, referenced from method com.tayek.qanda.Model.toPropertiesFile
12-20 23:02:14.829: W/dalvikvm(27907): VFY: unable to resolve static method 3399: Lcom/tayek/utilities/Utilities;.store (Ljava/io/File;Ljava/util/Properties;)V
12-20 23:02:14.829: D/dalvikvm(27907): VFY: replacing opcode 0x71 at 0x000f
12-20 23:02:14.849: I/dalvikvm(27907): Could not find method com.tayek.utilities.Utilities.store, referenced from method com.tayek.qanda.Model.toPropertiesFile
12-20 23:02:14.849: W/dalvikvm(27907): VFY: unable to resolve static method 3399: Lcom/tayek/utilities/Utilities;.store (Ljava/io/File;Ljava/util/Properties;)V
12-20 23:02:14.849: D/dalvikvm(27907): VFY: replacing opcode 0x71 at 0x0014
12-20 23:02:14.849: I/dalvikvm(27907): Could not find method com.tayek.utilities.Utilities.store, referenced from method com.tayek.qanda.Model.toPropertiesFile
12-20 23:02:14.849: W/dalvikvm(27907): VFY: unable to resolve static method 3400: Lcom/tayek/utilities/Utilities;.store (Ljava/io/Writer;Ljava/util/Properties;)V
12-20 23:02:14.849: D/dalvikvm(27907): VFY: replacing opcode 0x71 at 0x000f
12-20 23:02:14.849: I/dalvikvm(27907): Could not find method com.tayek.utilities.Utilities.store, referenced from method com.tayek.qanda.Model.toPropertiesFile
12-20 23:02:14.849: W/dalvikvm(27907): VFY: unable to resolve static method 3400: Lcom/tayek/utilities/Utilities;.store (Ljava/io/Writer;Ljava/util/Properties;)V
12-20 23:02:14.849: D/dalvikvm(27907): VFY: replacing opcode 0x71 at 0x0014
12-20 23:02:14.929: I/System.out(27907): Hospital Mortality Risk
12-20 23:02:14.969: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0
12-20 23:02:14.969: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0
12-20 23:02:14.969: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0
12-20 23:02:14.989: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0
12-20 23:02:15.029: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0
12-20 23:02:15.029: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0
12-20 23:02:15.040: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0
12-20 23:02:15.160: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0
12-20 23:02:15.160: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0
12-20 23:02:15.160: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0
12-20 23:02:15.169: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0
12-20 23:02:15.169: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0
12-20 23:02:15.169: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0
12-20 23:02:15.189: D/gralloc_goldfish(27907): Emulator without GPU emulation detected.
12-20 23:02:15.258: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0
12-20 23:02:15.299: W/Trace(27907): Unexpected value from nativeGetEnabledTags: 0

更新:导入带有琐碎类的 jar 可以正常工作。

4

1 回答 1

3

如果您使用的是 Java 7,您可以尝试更改 Java 库项目的运行时环境:

  1. 右键单击项目 -> 属性 -> Java 构建路径 -> 库

  2. 选择 JRE System Library [JavaSE-1.7] 并点击编辑

  3. 将执行环境更改为 JavaSE-1.6 (jre7)

这对我使用 ADT 21 有效。

于 2012-12-17T13:01:28.950 回答