Skip to content
Advertisement

error: no suitable method found for newArrayList(String)

I am fairly new to Java and trying to use a Google Cloud service. When I am trying to use an explicit way to point my service account following this guide from this; https://cloud.google.com/docs/authentication/production#passing_code

JavaScript

I already have installed requirements. However, this code throws an error as follows;

JavaScript

I am not sure what is wrong in my setting and no luck on searching an answer.

Advertisement

Answer

So a quick look at google’s documentation https://cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.Lists, it doesn’t contain a method newArrayList that takes a String as a parameter, but google has another library (guava) that contains the method you are looking for, https://guava.dev/releases/19.0/api/docs/com/google/common/collect/Lists.html, so replace your import com.google.api.client.util.Lists with import com.google.common.collect.Lists;;

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement