Ray Tayek
Ray Tayek

Reputation: 10003

android adt 17 - add jar to project - jar in dexedlibs/ only contains a manifest

i am using a 3 day old download of adt 17 on win 7 x64 with java 1.7.

adding a jar to my new sample project (by copying it to libs/) compiles fine, but throws at runtime because the classes in the jar are not in the corresponding jar in dexedlibs/ - that jar only contains a manifest.

related links: http://android.foxykeep.com/dev/how-to-fix-the-classdefnotfounderror-with-adt-17 and http://tools.android.com/recent/dealingwithdependenciesinandroidprojects.

doing some of the export and order stuff suggested in the links does not help.

how does one know how to add a jar to an android project these days?

edit: thanks to max: the jar was made using java 1.7, specifying 1.6 stopped the throwing, but i still get some missing methods for some reason (these are not called, but they are referenced).

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

update: importing a jar with trivial classes works fine.

Upvotes: 1

Views: 2012

Answers (1)

Max
Max

Reputation: 4405

If you are using Java 7 you can try changing the runtime environment for the Java library project:

  1. Right click and the project -> Properties -> Java Build Path -> Libraries

  2. Choose JRE System Library [JavaSE-1.7] and click edit

  3. Change execution environment to JavaSE-1.6 (jre7)

This worked for me using ADT 21.

Upvotes: 3

Related Questions