android - Youtube api 400 Bad Request

时间:2018-03-31 11:19:51

标签: android youtube-api youtube-data-api android-youtube-api

YouTube Api发出以下错误,但我提供了"代码段"作为查询的一部分,它在调试版本中运行良好,不能在我签名的Apk版本中工作

{
   "errors" : [ {
   "domain" : "global",
   "reason" : "required",
   "message" : "Required parameter: part",
   "locationType" : "parameter",
   "location" : "part"
   } ],
   "code" : 400,
   "message" : "Required parameter: part"
}

这是我的查询代码:      query = youTube.playlists()。list(" snippet");

 query.setKey(getYTkey());
 query.setChannelId(con[0].getString(R.string.CHANNEL_ID));
 query.setMaxResults((long) 25);

1 个答案:

答案 0 :(得分:2)

更改proguard规则如下:

-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