I have a thread on StackOverflow (titled: NoClassDefFoundError for Jersey 2.4.1 client in Android) but I thought I would reach out here in hope of getting a more specific/targeted audience group.
I have followed instructions from other posts about the libs Android dependency fix but I still get the issue.
I am using Eclipse Juno, with an Android App targeting API 17. Basically I am getting a NoClassDefFoundError at runtime for the org.glassfish.jersey.model.internal.CommonConfig$1 class located in jersey-client-2.4.1.jar. This is when I just do a Run As... deploy from within Eclipse and it fails when I instantiate the CommonConfig class or one that depends on it internally. The start up log is given below:
[HIGH]12-10 12:25:20.657: I/dalvikvm(10170): Failed resolving Lorg/glassfish/jersey/model/internal/CommonConfig$1; interface 920 'Lcom/google/common/base/Function;'
12-10 12:25:20.657: W/dalvikvm(10170): Link of class 'Lorg/glassfish/jersey/model/internal/CommonConfig$1;' failed
12-10 12:25:20.657: E/dalvikvm(10170): Could not find class 'org.glassfish.jersey.model.internal.CommonConfig$1', referenced from method org.glassfish.jersey.model.internal.CommonConfig.<clinit>
12-10 12:25:20.657: W/dalvikvm(10170): VFY: unable to resolve new-instance 2031 (Lorg/glassfish/jersey/model/internal/CommonConfig$1 in Lorg/glassfish/jersey/model/internal/CommonConfig;
12-10 12:25:20.657: D/dalvikvm(10170): VFY: replacing opcode 0x22 at 0x000c
12-10 12:25:20.657: W/dalvikvm(10170): VFY: unable to find class referenced in signature (Lcom/google/common/base/Predicate
12-10 12:25:20.657: W/dalvikvm(10170): VFY: unable to find class referenced in signature (Lcom/google/common/base/Predicate
12-10 12:25:20.657: I/dalvikvm(10170): Could not find method com.google.common.collect.Sets.newIdentityHashSet, referenced from method org.glassfish.jersey.model.internal.CommonConfig.<init>
12-10 12:25:20.657: W/dalvikvm(10170): VFY: unable to resolve static method 7321: Lcom/google/common/collect/Sets;.newIdentityHashSet ()Ljava/util/Set;
12-10 12:25:20.657: D/dalvikvm(10170): VFY: replacing opcode 0x71 at 0x002d
12-10 12:25:20.657: I/dalvikvm(10170): Could not find method com.google.common.collect.Lists.newLinkedList, referenced from method org.glassfish.jersey.model.internal.CommonConfig.<init>
12-10 12:25:20.657: W/dalvikvm(10170): VFY: unable to resolve static method 7309: Lcom/google/common/collect/Lists;.newLinkedList (Ljava/lang/IterableLjava/util/LinkedList;
12-10 12:25:20.657: D/dalvikvm(10170): VFY: replacing opcode 0x71 at 0x002e
12-10 12:25:20.657: I/dalvikvm(10170): Could not find method com.google.common.collect.Sets.newIdentityHashSet, referenced from method org.glassfish.jersey.model.internal.CommonConfig.asNewIdentitySet
12-10 12:25:20.657: W/dalvikvm(10170): VFY: unable to resolve static method 7321: Lcom/google/common/collect/Sets;.newIdentityHashSet ()Ljava/util/Set;
12-10 12:25:20.657: D/dalvikvm(10170): VFY: replacing opcode 0x71 at 0x0000
12-10 12:25:20.657: I/dalvikvm(10170): Could not find method com.google.common.collect.Sets.newIdentityHashSet, referenced from method org.glassfish.jersey.model.internal.CommonConfig.configureBinders
12-10 12:25:20.657: W/dalvikvm(10170): VFY: unable to resolve static method 7321: Lcom/google/common/collect/Sets;.newIdentityHashSet ()Ljava/util/Set;
12-10 12:25:20.657: D/dalvikvm(10170): VFY: replacing opcode 0x71 at 0x0000
12-10 12:25:20.657: W/dalvikvm(10170): VFY: unable to find class referenced in signature (Lcom/google/common/base/Predicate
12-10 12:25:20.657: I/dalvikvm(10170): Could not find method com.google.common.collect.Collections2.transform, referenced from method org.glassfish.jersey.model.internal.CommonConfig.getBinders
12-10 12:25:20.657: W/dalvikvm(10170): VFY: unable to resolve static method 7306: Lcom/google/common/collect/Collections2;.transform (Ljava/util/Collection;Lcom/google/common/base/FunctionLjava/util/Collection;
12-10 12:25:20.657: D/dalvikvm(10170): VFY: replacing opcode 0x71 at 0x000a
12-10 12:25:20.657: I/dalvikvm(10170): Failed resolving Lorg/glassfish/jersey/model/internal/CommonConfig$1; interface 920 'Lcom/google/common/base/Function;'
12-10 12:25:20.657: W/dalvikvm(10170): Link of class 'Lorg/glassfish/jersey/model/internal/CommonConfig$1;' failed
12-10 12:25:20.657: I/dalvikvm(10170): Failed resolving Lorg/glassfish/jersey/model/internal/CommonConfig$1; interface 920 'Lcom/google/common/base/Function;'
12-10 12:25:20.657: W/dalvikvm(10170): Link of class 'Lorg/glassfish/jersey/model/internal/CommonConfig$1;' failed
12-10 12:25:20.665: I/dalvikvm(10170): Failed resolving Lorg/glassfish/jersey/model/internal/CommonConfig$1; interface 920 'Lcom/google/common/base/Function;'
12-10 12:25:20.665: W/dalvikvm(10170): Link of class 'Lorg/glassfish/jersey/model/internal/CommonConfig$1;' failed
12-10 12:25:20.665: D/dalvikvm(10170): DexOpt: unable to opt direct call 0x3860 at 0x0e in Lorg/glassfish/jersey/model/internal/CommonConfig;.<clinit>
12-10 12:25:20.665: I/dalvikvm(10170): Failed resolving Lorg/glassfish/jersey/model/internal/CommonConfig$2; interface 924 'Lcom/google/common/base/Predicate;'
12-10 12:25:20.665: W/dalvikvm(10170): Link of class 'Lorg/glassfish/jersey/model/internal/CommonConfig$2;' failed
12-10 12:25:20.665: D/dalvikvm(10170): DexOpt: unable to opt direct call 0x3863 at 0x10 in Lorg/glassfish/jersey/model/internal/CommonConfig;.getBinders
12-10 12:25:20.665: W/dalvikvm(10170): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lorg/glassfish/jersey/model/internal/CommonConfig;
12-10 12:25:20.665: W/dalvikvm(10170): threadid=24: thread exiting with uncaught exception (group=0x411492a0)[/HIGH]
It doesn't seem to find a static inner class of CommonConfig. In the SO forum I tinkered with some options in ProGuard but I've come to learn that this isn't even used in the standard debug mode, only when you do a release build (Export from Eclipse). It would appear that something is happening with the class but I can't figure out why it would not be included if its parent is. Is there some kind of 'light' ProGuard process that goes on when a debug deploy is done?
Any ideas on how to resolve this particular case of NoClassDefFoundError?
I have followed instructions from other posts about the libs Android dependency fix but I still get the issue.
I am using Eclipse Juno, with an Android App targeting API 17. Basically I am getting a NoClassDefFoundError at runtime for the org.glassfish.jersey.model.internal.CommonConfig$1 class located in jersey-client-2.4.1.jar. This is when I just do a Run As... deploy from within Eclipse and it fails when I instantiate the CommonConfig class or one that depends on it internally. The start up log is given below:
[HIGH]12-10 12:25:20.657: I/dalvikvm(10170): Failed resolving Lorg/glassfish/jersey/model/internal/CommonConfig$1; interface 920 'Lcom/google/common/base/Function;'
12-10 12:25:20.657: W/dalvikvm(10170): Link of class 'Lorg/glassfish/jersey/model/internal/CommonConfig$1;' failed
12-10 12:25:20.657: E/dalvikvm(10170): Could not find class 'org.glassfish.jersey.model.internal.CommonConfig$1', referenced from method org.glassfish.jersey.model.internal.CommonConfig.<clinit>
12-10 12:25:20.657: W/dalvikvm(10170): VFY: unable to resolve new-instance 2031 (Lorg/glassfish/jersey/model/internal/CommonConfig$1 in Lorg/glassfish/jersey/model/internal/CommonConfig;
12-10 12:25:20.657: D/dalvikvm(10170): VFY: replacing opcode 0x22 at 0x000c
12-10 12:25:20.657: W/dalvikvm(10170): VFY: unable to find class referenced in signature (Lcom/google/common/base/Predicate
12-10 12:25:20.657: W/dalvikvm(10170): VFY: unable to find class referenced in signature (Lcom/google/common/base/Predicate
12-10 12:25:20.657: I/dalvikvm(10170): Could not find method com.google.common.collect.Sets.newIdentityHashSet, referenced from method org.glassfish.jersey.model.internal.CommonConfig.<init>
12-10 12:25:20.657: W/dalvikvm(10170): VFY: unable to resolve static method 7321: Lcom/google/common/collect/Sets;.newIdentityHashSet ()Ljava/util/Set;
12-10 12:25:20.657: D/dalvikvm(10170): VFY: replacing opcode 0x71 at 0x002d
12-10 12:25:20.657: I/dalvikvm(10170): Could not find method com.google.common.collect.Lists.newLinkedList, referenced from method org.glassfish.jersey.model.internal.CommonConfig.<init>
12-10 12:25:20.657: W/dalvikvm(10170): VFY: unable to resolve static method 7309: Lcom/google/common/collect/Lists;.newLinkedList (Ljava/lang/IterableLjava/util/LinkedList;
12-10 12:25:20.657: D/dalvikvm(10170): VFY: replacing opcode 0x71 at 0x002e
12-10 12:25:20.657: I/dalvikvm(10170): Could not find method com.google.common.collect.Sets.newIdentityHashSet, referenced from method org.glassfish.jersey.model.internal.CommonConfig.asNewIdentitySet
12-10 12:25:20.657: W/dalvikvm(10170): VFY: unable to resolve static method 7321: Lcom/google/common/collect/Sets;.newIdentityHashSet ()Ljava/util/Set;
12-10 12:25:20.657: D/dalvikvm(10170): VFY: replacing opcode 0x71 at 0x0000
12-10 12:25:20.657: I/dalvikvm(10170): Could not find method com.google.common.collect.Sets.newIdentityHashSet, referenced from method org.glassfish.jersey.model.internal.CommonConfig.configureBinders
12-10 12:25:20.657: W/dalvikvm(10170): VFY: unable to resolve static method 7321: Lcom/google/common/collect/Sets;.newIdentityHashSet ()Ljava/util/Set;
12-10 12:25:20.657: D/dalvikvm(10170): VFY: replacing opcode 0x71 at 0x0000
12-10 12:25:20.657: W/dalvikvm(10170): VFY: unable to find class referenced in signature (Lcom/google/common/base/Predicate
12-10 12:25:20.657: I/dalvikvm(10170): Could not find method com.google.common.collect.Collections2.transform, referenced from method org.glassfish.jersey.model.internal.CommonConfig.getBinders
12-10 12:25:20.657: W/dalvikvm(10170): VFY: unable to resolve static method 7306: Lcom/google/common/collect/Collections2;.transform (Ljava/util/Collection;Lcom/google/common/base/FunctionLjava/util/Collection;
12-10 12:25:20.657: D/dalvikvm(10170): VFY: replacing opcode 0x71 at 0x000a
12-10 12:25:20.657: I/dalvikvm(10170): Failed resolving Lorg/glassfish/jersey/model/internal/CommonConfig$1; interface 920 'Lcom/google/common/base/Function;'
12-10 12:25:20.657: W/dalvikvm(10170): Link of class 'Lorg/glassfish/jersey/model/internal/CommonConfig$1;' failed
12-10 12:25:20.657: I/dalvikvm(10170): Failed resolving Lorg/glassfish/jersey/model/internal/CommonConfig$1; interface 920 'Lcom/google/common/base/Function;'
12-10 12:25:20.657: W/dalvikvm(10170): Link of class 'Lorg/glassfish/jersey/model/internal/CommonConfig$1;' failed
12-10 12:25:20.665: I/dalvikvm(10170): Failed resolving Lorg/glassfish/jersey/model/internal/CommonConfig$1; interface 920 'Lcom/google/common/base/Function;'
12-10 12:25:20.665: W/dalvikvm(10170): Link of class 'Lorg/glassfish/jersey/model/internal/CommonConfig$1;' failed
12-10 12:25:20.665: D/dalvikvm(10170): DexOpt: unable to opt direct call 0x3860 at 0x0e in Lorg/glassfish/jersey/model/internal/CommonConfig;.<clinit>
12-10 12:25:20.665: I/dalvikvm(10170): Failed resolving Lorg/glassfish/jersey/model/internal/CommonConfig$2; interface 924 'Lcom/google/common/base/Predicate;'
12-10 12:25:20.665: W/dalvikvm(10170): Link of class 'Lorg/glassfish/jersey/model/internal/CommonConfig$2;' failed
12-10 12:25:20.665: D/dalvikvm(10170): DexOpt: unable to opt direct call 0x3863 at 0x10 in Lorg/glassfish/jersey/model/internal/CommonConfig;.getBinders
12-10 12:25:20.665: W/dalvikvm(10170): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lorg/glassfish/jersey/model/internal/CommonConfig;
12-10 12:25:20.665: W/dalvikvm(10170): threadid=24: thread exiting with uncaught exception (group=0x411492a0)[/HIGH]
It doesn't seem to find a static inner class of CommonConfig. In the SO forum I tinkered with some options in ProGuard but I've come to learn that this isn't even used in the standard debug mode, only when you do a release build (Export from Eclipse). It would appear that something is happening with the class but I can't figure out why it would not be included if its parent is. Is there some kind of 'light' ProGuard process that goes on when a debug deploy is done?
Any ideas on how to resolve this particular case of NoClassDefFoundError?