Skip to content

Incompatibility with Guava 33.4.1+ leads to "NoSuchFieldError: No static field MODULE" #413

Description

@faenil

hi :)

First of all, I would like to thank you for your work on this plugin, it is incredibly valuable and appreciated.

I would like to surface an incompatibility I have been noticing for some time, about 1 year:
Adding a dependency on Guava 33.4.1+ leads to test failures on Android 9/10/11.

It appears the failure might be a result of this plugin trying to read the annotations on Guava's classes.

The behaviour is also explained at this issue page
google/truth#1608

Here is a sample stacktrace from the linked issue

> Task :database:connectedDebugAndroidTest
Starting 9 tests on emulator-5554 - 8.0.0
com.google.common.collect.ObjectCountHashMap > initializationError[emulator-5554 - 8.0.0] FAILED 
	java.lang.NoSuchFieldError: No static field MODULE of type Ljava/lang/annotation/ElementType; in class Ljava/lang/annotation/ElementType; or its superclasses (declaration of 'java.lang.annotation.ElementType' appears in /system/framework/core-oj.jar)
	at java.lang.Class.getDeclaredAnnotations(Native Method)
com.google.common.collect.ObjectCountLinkedHashMap > initializationError[emulator-5554 - 8.0.0] FAILED 
	java.lang.NoSuchFieldError: No static field MODULE of type Ljava/lang/annotation/ElementType; in class Ljava/lang/annotation/ElementType; or its superclasses (declaration of 'java.lang.annotation.ElementType' appears in /system/framework/core-oj.jar)
	at java.lang.Class.getDeclaredAnnotations(Native Method)
com.google.common.util.concurrent.ImmediateFuture > initializationError[emulator-5554 - 8.0.0] FAILED 
	java.lang.NoSuchFieldError: No static field MODULE of type Ljava/lang/annotation/ElementType; in class Ljava/lang/annotation/ElementType; or its superclasses (declaration of 'java.lang.annotation.ElementType' appears in /system/framework/core-oj.jar)
	at java.lang.Class.getDeclaredAnnotations(Native Method)
com.google.common.util.concurrent.ListenableFutureTask > initializationError[emulator-5554 - 8.0.0] FAILED 
	java.lang.NoSuchFieldError: No static field MODULE of type Ljava/lang/annotation/ElementType; in class Ljava/lang/annotation/ElementType; or its superclasses (declaration of 'java.lang.annotation.ElementType' appears in /system/framework/core-oj.jar)
	at java.lang.Class.getDeclaredAnnotations(Native Method)
Tests on emulator-5554 - 8.0.0 failed: There was 4 failure(s).
Finished 9 tests on emulator-5554 - 8.0.0
> Task :database:connectedDebugAndroidTest FAILED

Is there any chance you could have a look? :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions