title: android keep the reference to old google api project
body: <p>I am working with YouTube google api and I have this error:</p>
  
  <pre><code>com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
  04-15 13:25:42.951 22653-24865/com.player.jointv W/System.err: {
  04-15 13:25:42.951 22653-24865/com.player.jointv W/System.err:   "code" : 403,
  04-15 13:25:42.951 22653-24865/com.player.jointv W/System.err:   "errors" : [ {
  04-15 13:25:42.951 22653-24865/com.player.jointv W/System.err:     "domain" : "usageLimits",
  04-15 13:25:42.951 22653-24865/com.player.jointv W/System.err:     "message" : "Access Not Configured. YouTube Data API has not been used in project XXXXXXXXXXXX before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube/overview?project=XXXXXXXXXXXX then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
  04-15 13:25:42.951 22653-24865/com.player.jointv W/System.err:     "reason" : "accessNotConfigured",
  04-15 13:25:42.951 22653-24865/com.player.jointv W/System.err:     "extendedHelp" : "https://console.developers.google.com/apis/api/youtube/overview?project=XXXXXXXXXXXX"
  04-15 13:25:42.951 22653-24865/com.player.jointv W/System.err:   } ],
  04-15 13:25:42.951 22653-24865/com.player.jointv W/System.err:   "message" : "Access Not Configured. YouTube Data API has not been used in project XXXXXXXXXXXX before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube/overview?project=XXXXXXXXXXXX then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."
  04-15 13:25:42.951 22653-24865/com.player.jointv W/System.err: }
  </code></pre>
  
  <p>I thought that my problem was with an disable api or maybe using a wrong username but then I click on the project reference in the error and I saw that the project ID (XXXXXXXXXXXX) is wrong because it was an old project.</p>
  
  <h2>The problems are:</h2>
  
  <ul>
  <li>I don't know how to update or what do I need to change in order to
  get the new project ID??</li>
  <li>Do I need to remove any trash file??</li>
  <li>Where or how android project keep these references? I am worry about that because if I need to remove the current project maybe I will get the same error in the future.</li>
  </ul>
  
  <h2>Tools.</h2>
  
  <p>Using Android Studio 2.0 on Windows.</p>
  
  <h2>Get the Auth Token</h2>
  
  <p>I get the token using <strong><em>GoogleAuthUtils</em></strong>: </p>
  
  <pre><code>token = GoogleAuthUtil.getToken(context, account, Config.YOUTUBE_SCOPES);
  </code></pre>
  
  <p>Where:</p>
  
  <p><strong>context</strong>: AppCompatActivity</p>
  
  <p><strong>account</strong>: Account</p>
  
  <p><strong>Config.YOUTUBE_SCOPES</strong>:  </p>
  
  <pre><code>final String YOUTUBE_SCOPES = "oauth2:https://www.googleapis.com/auth/yt-analytics.readonly" +
              " https://www.googleapis.com/auth/youtube.readonly";
  </code></pre>
  
  <h2>Creating Credentials</h2>
  
  <p>I took this peace of code from <a href="https://developers.google.com/api-client-library/java/google-api-java-client/oauth2#credential" rel="nofollow">Google Credential example</a>:</p>
  
  <pre><code>GoogleCredential credential = new GoogleCredential()
                                    .setAccessToken(authToken);
  </code></pre>
  
  <h2>Using credential to configure the api services.</h2>
  
  <pre><code>// This object is used to make YouTube Data API requests.
  youtube = new YouTube.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
                      .setApplicationName("youtube-analytics-api-report-example")
                      .build();
  
  //This object is used to make YouTube Analytics API requests.
  analytics = new YouTubeAnalytics
                  .Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
                  .setApplicationName("youtube-analytics-api-report-example")
                  .build();
  </code></pre>
  
  <h2>Using a web API KEY</h2>
  
  <p>I create a web api key and I got the error:</p>
  
  <pre><code>04-15 15:36:27.274 14733-16676/com.player.jointv W/System.err: com.google.api.client.googleapis.json.GoogleJsonResponseException: 401 Unauthorized
  04-15 15:36:27.274 14733-16676/com.player.jointv W/System.err: {
  04-15 15:36:27.274 14733-16676/com.player.jointv W/System.err:   "code" : 401,
  04-15 15:36:27.274 14733-16676/com.player.jointv W/System.err:   "errors" : [ {
  04-15 15:36:27.274 14733-16676/com.player.jointv W/System.err:     "domain" : "global",
  04-15 15:36:27.274 14733-16676/com.player.jointv W/System.err:     "location" : "Authorization",
  04-15 15:36:27.274 14733-16676/com.player.jointv W/System.err:     "locationType" : "header",
  04-15 15:36:27.274 14733-16676/com.player.jointv W/System.err:     "message" : "Invalid Credentials",
  04-15 15:36:27.274 14733-16676/com.player.jointv W/System.err:     "reason" : "authError"
  04-15 15:36:27.274 14733-16676/com.player.jointv W/System.err:   } ],
  04-15 15:36:27.274 14733-16676/com.player.jointv W/System.err:   "message" : "Invalid Credentials"
  04-15 15:36:27.274 14733-16676/com.player.jointv W/System.err: }
  </code></pre>
  
  <p>What is happen? I feel bad?</p>