quot;You have not specified a View to use as content for popupsquot;(“您尚未指定要用作弹出窗口内容的视图)
问题描述
所以我一直在尝试在我的游戏中实现排行榜/成就,并且没有任何类型的实现,游戏运行得很好.我已成功导入 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.
这篇关于“您尚未指定要用作弹出窗口内容的视图"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:“您尚未指定要用作弹出窗口内容的视图"


基础教程推荐
- 如何从 logcat 中删除旧数据? 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01