"你还没有指定显示为弹出窗口&QUOT内容的使用;你还、弹出窗口、内容、QUOT

2023-09-06 10:05:27 作者:再無賴也只是個男人。

所以,我一直在努力实现我的游戏排行榜/成就,并没有任何形式实现,游戏运行得很好。我已经成功地导入了谷歌,播放服务-lib和复制BaseGameUtils。但每当我试着呼叫建立过程GameHelper对象,它崩溃了。 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的未来版本中正常工作的活动内容视图。使用setViewForPopups()设置内容视图。 关闭虚拟机。

getCSCPackageItemText() You have not specified a View to use as content view for popups. Falling back to the Activity content view which may not work properly in future versions of this API. Use setViewForPopups() to set content view. Shutting down VM.

下面说了一下,这个错误也给出了:

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.

我到处搜寻,并没有其他人好像特别有这个问题。任何建议?我使用的是谷歌,播放服务-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.