Skip to content

Firestore tests fail in Android Studio #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ashwinraghav opened this issue Nov 2, 2018 · 4 comments · Fixed by #110
Closed

Firestore tests fail in Android Studio #108

ashwinraghav opened this issue Nov 2, 2018 · 4 comments · Fixed by #110

Comments

@ashwinraghav
Copy link
Contributor

@schmidt-sebastian noticed yesterday that the firebase-firestore tests fail when run from AS, but not from cli.

java.lang.NoSuchMethodError: com.google.common.base.Strings.lenientFormat(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

	at com.google.common.truth.Subject.named(Subject.java:154)
	at com.google.firebase.firestore.testutil.ComparatorTester.doTestEquivalanceGroupOrdering(ComparatorTester.java:159)
	at com.google.firebase.firestore.testutil.ComparatorTester.testCompare(ComparatorTester.java:145)
	at com.google.firebase.firestore.BlobTest.testComparison(BlobTest.java:51)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:606)
	at org.robolectric.internal.SandboxTestRunner$2.evaluate(SandboxTestRunner.java:268)
	at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:130)
	at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:42)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.robolectric.internal.SandboxTestRunner$1.evaluate(SandboxTestRunner.java:84)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

[Robolectric] com.google.firebase.firestore.BlobTest.testMutableBytes: sdk=16; resources=legacy
[Robolectric] com.google.firebase.firestore.BlobTest.testEquals: sdk=16; resources=legacy

I have been able to repro the issue. Initially, I had 17 tests failing in AS, but recreating the AS project brought that down to 5.

It seems related to the issue described here [https://github.com/google/truth/issues/466] which is relevant after the upgrades we got to libraries via @iamyaoxi 's PR #73.

@ashwinraghav
Copy link
Contributor Author

@iamyaoxi Do you think you can help us track down and fix this issue ?

@ashwinraghav ashwinraghav changed the title Firestire tests fail in Android Studio Firestore tests fail in Android Studio Nov 2, 2018
vkryachko added a commit that referenced this issue Nov 2, 2018
This avoids the dependency on Guava 25.1 which causes tests run through
Android Studio to fail. Fixes #108.
vkryachko added a commit that referenced this issue Nov 2, 2018
This avoids the dependency on Guava 25.1 which causes tests run through
Android Studio to fail. Fixes #108.
@ashwinraghav
Copy link
Contributor Author

After pulling in the new change, I had to delete my AS project and re-import the gradle project to make the issue go away

@yos1p
Copy link
Contributor

yos1p commented Nov 2, 2018

Do you think its related to some bugs in AS perhaps?

@vkryachko
Copy link
Member

It does seem to be a bug in AS. Some details I found:

  • Firestore's implementation configuration depends on grpc:1.12.0, which in turn depends on guava:20.
  • Firestore's testImplementation configuration depends on truth:0.42, which in turn depends on guava:25.1

Now when the test classpath is resolved by gradle it notices the version difference and only adds the latest one onto the classpath.

But when AS runs the tests I can see that both versions of guava are present on the classpath with 20 being first, hence it is picked up by the class loader.

@firebase firebase locked and limited conversation to collaborators Oct 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants