Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failed with exception for task ':run' #3

Open
hilmanski opened this issue May 28, 2024 · 0 comments
Open

Build failed with exception for task ':run' #3

hilmanski opened this issue May 28, 2024 · 0 comments

Comments

@hilmanski
Copy link

Currently, running the code sample shows this error

> Task :run
find the first Coffee in Austin,Texas
Exception in thread "main" java.lang.NullPointerException
	at demo.App.main(App.java:43)

> Task :run FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> Process 'command '/Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java'' finished with non-zero exit value 1

The error wasn't clear at first, but I noticed from the default sample, we should replace local_results with more generic results since local_results is not always available on the response.

Here is my update suggestion for the code sample and readme instruction:

 JsonArray results = data.get("organic_results").getAsJsonArray(); 
JsonObject first_result = results.get(0).getAsJsonObject();
System.out.println(first_result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant