Skip to content

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

@hilmanski

Description

@hilmanski

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions