“您尚未指定要用作弹出窗口内容的视图"

编程入门 行业动态 更新时间:2024-10-24 14:20:19
本文介绍了“您尚未指定要用作弹出窗口内容的视图"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

所以我一直在尝试在我的游戏中实现排行榜/成就,并且没有任何类型的实现,游戏运行得很好.我已成功导入 google-play-services-lib 并复制到 BaseGameUtils.但每当我尝试为 GameHelper 对象调用 setup 时,它就会崩溃.LogCat 给出以下错误:

So I've been trying to implement Leaderboards/Achievements in my game, and without any kind of implementation, the game runs just fine. I've successfully imported the google-play-services-lib and copied over BaseGameUtils. But whenever I try to call setup for a GameHelper object, it crashes it. LogCat gives the following error:

getCSCPackageItemText()您尚未指定要用作弹出窗口的内容视图的视图.回退到在此 API 的未来版本中可能无法正常工作的 Activity 内容视图.使用 setViewForPopups() 设置内容视图.关闭虚拟机.

稍低于此,也会出现这个错误:

A bit below that, this error is also given:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.packagename.AndroidLauncher}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content

然而,我看到的所有关于将 GPGS 与 libGDX 集成的教程都没有使用这些函数中的任何一个.我已经尝试在我的主视图上实现 setViewForPopups(我正在使用 Mopub 进行广告,所以我将两个视图放入一个布局中),但它似乎并没有改变任何东西.这是我的 onCreate 方法中似乎导致崩溃的部分:

Yet all the tutorials I've seen on integrating GPGS with libGDX never use either of those functions. I've tried implementing setViewForPopups on my main view(I'm using Mopub for ads, so I put two views into a layout), but it doesn't seem to change anything. Here's the section of my onCreate method that seems to cause the crash:

super.onCreate(savedInstanceState); gameHelper = new GameHelper(this, GameHelper.CLIENT_GAMES); gameHelper.enableDebugLog(false); GameHelperListener gameHelperListener = new GameHelper.GameHelperListener() { @Override public void onSignInSucceeded() { } @Override public void onSignInFailed() { } }; gameHelper.setup(gameHelperListener); //This line causes the error. Removing it lets it work just fine.

我到处搜索,似乎没有其他人专门遇到这个问题.有什么建议吗?我正在使用最新版本的 google-play-services-lib 和 BaseGameUtils.

I've searched everywhere and no one else seemed to have this problem specifically. Any advice? I'm using the newest versions of google-play-services-lib and BaseGameUtils.

推荐答案

我想通了.事实证明,我所要做的就是将 gameHelper.setup 调用移到 onCreate 方法的最后,它工作得很好.

I figured it out. Turns out all I had to do was move the gameHelper.setup call to the very end of the onCreate method and it works just fine.

更多推荐

“您尚未指定要用作弹出窗口内容的视图"

本文发布于:2023-11-05 09:26:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1560461.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:要用   视图   您尚未   弹出窗口   内容

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!