0
votes

I am using the YouTube Data API to search YouTube videos. Everything is working perfectly in debug. When I switch to release, I get this error

Access Not Configured. YouTube Data API has not been used in project 608######### before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube/overview?project=608######### then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

The project number 608######### isn't even the correct project number. When I click on that URL, I get this error message

The API "youtube" doesn't exist or you don't have permission to access it

I have entered all of my information in the Google APIs Console and have my API key. As I said earlier, everything worked fine in the debug build.

Maybe I am missing something from my Proguard file. This is what is it in now:

-keep class com.google.**
-keep interface com.google.** { *;}
-dontwarn com.google.**

-keep class com.google.api.** {
    *;
}

# Needed by google-api-client to keep generic types and @Key annotations accessed via reflection
-keepclassmembers class * {
  @com.google.api.client.util.Key <fields>;
}

# Needed by google-http-client-android when linking against an older platform version
-dontwarn com.google.api.client.extensions.android.**

# Needed by google-api-client-android when linking against an older platform version
-dontwarn com.google.api.client.googleapis.extensions.android.**

# Needed by google-play-services when linking against an older platform version
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**
-dontnote com.google.android.gms.**

# com.google.client.util.IOUtils references java.nio.file.Files when on Java 7+
-dontnote java.nio.file.Files, java.nio.file.Path

# Suppress notes on LicensingServices
-dontnote **.ILicensingService

# Suppress warnings on sun.misc.Unsafe
-dontnote sun.misc.Unsafe
-dontwarn sun.misc.Unsafe

I have also tried setting my API key to have unrestricted access and setting it to Android apps only and entering in my package name and SHA1. Any help would be greatly appreciated!

1

1 Answers

0
votes

Well you need to go through this, i believe you missed some of the steps. In debug mode some api works without key,but in release mode it is necessary.

  1. You need a Google Account to access the Google Developers Console, request an API key, and register your application.

  2. Create a project in the Google Developers Console and obtain authorization credentialsso your application can submit API requests.

  3. After creating your project, make sure the YouTube Data API is one of the services that your application is registered to use:

    • Go to the Developers Console and select the project that you just registered.
    • Open the API Library in the Google Developers Console. If prompted, select a project or create a new one. In the list of APIs, make sure the status is ON for the YouTube Data API v3.
  4. If your application will use any API methods that require user authorization, read the authentication guide to learn how to implement OAuth 2.0 authorization.

  5. Select a client library to simplify your API implementation.

Courtesy: https://developers.google.com/youtube/v3/getting-started