Reputation: 13
Here am accessing the credentials file by placing file in raw folder I am passing the path like this
GoogleCredentials.fromStream(new FileInputStream("android.resource://com.tvs.digi.dmsapp/raw/dms_app_google"))
And I am getting below error
android.resource:/com.tvs.digi.dmsapp/raw/dms_app_google: open failed: ENOENT (No such file or directory)
Upvotes: 1
Views: 1852
Reputation: 155
Kindly use below code for access your json file.
Update: 2 Can you please try to set the environment variable by adding json file path.
val inputStream = this.getAssets().open("XXXXX-6e000f81XXXX.json")
val credentials = GoogleCredentials.fromStream(inputStream) .createScoped(Lists.newArrayList("https://www.googleapis.com/auth/cloudplatform"))
val credentialsProvider = FixedCredentialsProvider.create(credentials)
val speechSettings = SpeechSettings.newBuilder().setCredentialsProvider(credentialsProvider).build();
Hope it helps you.
Upvotes: 2