Android YouTube API “An error occurred while initializing YouTube player”

牧云@^-^@ 提交于 2019-12-03 20:34:55

The problem was in fact proguard. Here is what i added to the proguard-project.txt file:

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

This one worked for me:

-keepclassmembers class fqcn.of.javascript.interface.for.webview {
   public *;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!