Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"You have not specified a View to use as content for popups"

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() 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

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.

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.

like image 590
mszik Avatar asked Sep 18 '14 22:09

mszik


1 Answers

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.

like image 50
mszik Avatar answered Nov 14 '22 12:11

mszik