question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState

See original GitHub issue

Here is my code

FileInputStream serviceAccount = new FileInputStream("firebase.json");
		FirebaseOptions options = new FirebaseOptions.Builder()
			.setCredential(FirebaseCredentials.fromCertificate(serviceAccount))
			.setDatabaseUrl("https://xxxxx.firebaseio.com/")
			.build();
		FirebaseApp.initializeApp(options);
		FirebaseAuth.getInstance();

FirebaseAuth.getInstance(); causing the issue. The error log stack is here

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)V
	at com.google.firebase.FirebaseApp.checkNotDeleted(FirebaseApp.java:314)
	at com.google.firebase.FirebaseApp.getOptions(FirebaseApp.java:260)
	at com.google.firebase.auth.FirebaseAuth.<init>(FirebaseAuth.java:74)
	at com.google.firebase.auth.FirebaseAuth.<init>(FirebaseAuth.java:61)
	at com.google.firebase.auth.FirebaseAuth.<init>(FirebaseAuth.java:52)
	at com.google.firebase.auth.FirebaseAuth$FirebaseAuthService.<init>(FirebaseAuth.java:316)
	at com.google.firebase.auth.FirebaseAuth.getInstance(FirebaseAuth.java:98)
	at com.google.firebase.auth.FirebaseAuth.getInstance(FirebaseAuth.java:85)
	at com.datasignstech.lam.core.google.GoogleInterface.main(GoogleInterface.java:119)

I am not sure why I am getting the above error. I see the code and at FirebaseApp.java:314 it is passing 3 arguments, but in error it is showing only two arguments, which is not there in Preconditions. Kindly help me in this.

I am using firebase-admin sdk: 5.2.0 Jdk: 1.8.0 OS: Ubuntu 16.04

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:21 (5 by maintainers)

github_iconTop GitHub Comments

10reactions
hthcommented, Aug 6, 2017

Code below should fix this issue.

compile ('com.google.firebase:firebase-admin:5.2.0') {
   exclude group: 'com.google.guava'
}
compile 'com.google.guava:guava:23.0'
6reactions
galcyuriocommented, Nov 16, 2017

maven solution example

<dependency>
    <groupId>com.google.firebase</groupId>
    <artifactId>firebase-admin</artifactId>
    <version>${firebase.version}</version>
    <exclusions>
        <exclusion>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>${guava.version}</version>
</dependency>
Read more comments on GitHub >

github_iconTop Results From Across the Web

5 - Stack Overflow
java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;) with Selenium, gradle and ChromeDriver.
Read more >
Issues - GitHub
lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/ ...
Read more >
Java.lang.NoSuchMethodError is throwing | Selenium Forum
Java.lang.NoSuchMethodError is throwing .Throwing the below error while executing the program, Attached the pom.xml file used to compile ...
Read more >
[selenium-users] java.lang.NoSuchMethodError: com.google ...
Im getting this error. java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/ ...
Read more >
java.lang.NoSuchMethodError: com.google ... - Google Groups
java.lang.NoSuchMethodError: com.google.common.base.Preconditions ... checkState(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found