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

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.

这篇关于“您尚未指定要用作弹出窗口内容的视图"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:“您尚未指定要用作弹出窗口内容的视图"

基础教程推荐