title: java: cannot access com.google.auth.Credentials class file for com.google.auth.Credentials not found
body: <p>I'm using the firebase Admin SDK and im getting this error at runtime:</p>
  
  <pre><code>Error:(22, 36) java: cannot access com.google.auth.Credentials
  class file for com.google.auth.Credentials not found
  </code></pre>
  
  <p>This is the constructor that is throwing the error</p>
  
  <pre><code>import com.google.auth.oauth2.GoogleCredentials;
  import com.google.firebase.FirebaseApp;
  import com.google.firebase.FirebaseOptions;
  import com.google.firebase.database.*;
  
  import java.io.IOException;
  import java.io.InputStream;
  import java.util.ArrayList;
  
  class Database{
  
  private FirebaseDatabase firebaseDatabase;
  
  Database(){
  
      InputStream serviceAccount = Database.class.getResourceAsStream("reading-incentive-firebase-adminsdk-n556s-1b742e4b58.json");
  
      FirebaseOptions options;
      try {
          options = new FirebaseOptions.Builder()
                  .setCredentials( GoogleCredentials.fromStream(serviceAccount))
                  .setDatabaseUrl("https://reading-incentive.firebaseio.com")
                  .build();
          FirebaseApp.initializeApp(options);
      } catch (IOException e) {
          e.printStackTrace();
          System.out.println("Error loading database");
      }
  
      firebaseDatabase = FirebaseDatabase.getInstance();
  
  }
  
  }
  </code></pre>
  
  <p>this is line 22</p>
  
  <blockquote>
    <p>.setCredentials(GoogleCredentials.fromStream(serviceAccount))</p>
  </blockquote>
  
  <p>I'm using the java sdk 1.8 in IntelliJ along with gradle. I've read other posts and read that using sdk 1.8 over 1.7 throws the error but I can't find a solution. Here is my build.gradle file...</p>
  
  <pre><code>group 'src'
  version '1.0-SNAPSHOT'
  
  apply plugin: 'java'
  
  sourceCompatibility = 1.8
  
  repositories {
      mavenCentral()
  }
  
  dependencies {
      testCompile group: 'junit', name: 'junit', version: '4.12'
      implementation 'com.google.firebase:firebase-admin:6.5.0'
  }
  </code></pre>
  
  <p>Thanks for any help.</p>