title: How to search videos with youtube data API in Android
body: <p>I'm developing an application in Android which needs to search for videos of YouTube by Keyword. I have used Youtube data API with the code below:</p>
  
  <pre><code>    try {
          youtube = new YouTube.Builder(Auth.HTTP_TRANSPORT, Auth.JSON_FACTORY, new HttpRequestInitializer() {
              public void initialize(HttpRequest request) throws IOException {
              }
          }).setApplicationName("YoutubeQoE").build();
  
          // Define the API request for retrieving search results.
          YouTube.Search.List search = youtube.search().list("id,snippet");
  
          // Set your developer key from the Google Cloud Console for
          // non-authenticated requests. See:
          // https://cloud.google.com/console
          search.setKey(DeveloperKey.DEVELOPER_KEY);
          search.setQ("dogs");
  
          // Restrict the search results to only include videos. See:
          // https://developers.google.com/youtube/v3/docs/search/list#type
          search.setType("video");
  
          // To increase efficiency, only retrieve the fields that the
          // application uses.
          //search.setFields("items(id/kind,id/videoId,snippet/title,snippet/thumbnails/default/url)");
          search.setMaxResults(25);
  
          SearchListResponse searchResponse = search.execute();
          List&lt;SearchResult&gt; lista = searchResponse.getItems();
  
      } catch (GoogleJsonResponseException e) {
          System.err.println("There was a service error: " + e.getDetails().getCode() + " : "
                  + e.getDetails().getMessage());
      } catch (IOException e) {
          System.err.println("There was an IO error: " + e.getCause() + " : " + e.getMessage());
      } catch (Throwable t) {
          t.printStackTrace();
      }
  </code></pre>
  
  <p>For de DEVELOPER_KEY I have used a public API access at google developer console.</p>
  
  <p>But when I execute the program there is a problem in the line:</p>
  
  <p>SearchListResponse searchResponse = search.execute();</p>
  
  <p>In the android manifest.xml I have these permissions:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt;
  </code></pre>
  
  <p>I would be very grateful if anybody could help me</p>