尝试构建我的android xamarin项目时出现以下错误。我以前从来没有碰过这个,我也不知道如何修复它。有人有主意吗?有没有办法添加依赖?我在这里想的还不错吗?
... Android / obj / Debug / android / src / md548954d6403a7d9a6fe546c5860c66901 / BenefitDetailFragment.java(50,50):错误:错误:包com.google.android.youtube.player.YouTubePlayer不存在 com.google.android.youtube.player.YouTubePlayer.OnInitializedListener, (* .Android)javac
这是我的初始化代码:
public void OnInitializationFailure(IYouTubePlayerProvider provider, YouTubeInitializationResult errorReason)
{
if (errorReason.IsUserRecoverableError)
{
errorReason.GetErrorDialog(Activity, RECOVERY_REQUEST).Show();
}
else
{
String error = String.Format("Something went wrong with youtube player.", errorReason.ToString());
ShowSnackBar(Activity, error, linearMoreInfo, Resource.Color.colorAccent);
}
}
public void OnInitializationSuccess(IYouTubePlayerProvider p0, IYouTubePlayer player, bool wasRestored)
{
mPlayer = player;
if (!wasRestored)
{
player.SetOnFullscreenListener(this);
if (!String.IsNullOrEmpty(videoId))
{
player.CueVideo(videoId);
}
else
{
player.CueVideo("wKJ9KzGQq0w");
}
}
}
答案 0 :(得分:0)
我通过将YouTubeAndroidPlayerApi.jar的Build Action更改为EmbeddedJar来解决了这个问题