I am trying to set up GoogleCredentials
with BigQuery into android but setting up the credential using _service_account.json_ is not working.
It throws FileNotFoundException error while fetching the service_account.json file, When I try to load the file with InputStream the same error occurs.
This is my code
GoogleCredentials credentials;
File credentialsPath = new File("service_account.json");
try (FileInputStream serviceAccountStream = new FileInputStream(credentialsPath)) {
credentials = ServiceAccountCredentials.fromStream(serviceAccountStream);
} // Instantiate a client.
BigQuery bigquery = BigQueryOptions.newBuilder().setCredentials(credentials).build().getService();
Note: I have place service_account.json under app/assets folder