"You did not specify View to use as content for pop-ups"

So, I'm trying to implement Leaderboards / Achievements in my game, and without any implementation the game works fine. I successfully imported google-play-services-lib and copied it over BaseGameUtils. But whenever I try to call setup for a GameHelper object, it resets 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 little below this, this error is also indicated:

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

However, all the tutorials I've seen when integrating GPGS with libGDX never use any of these features. I tried to implement setViewForPopups on my main view (I use Mopub for advertising, so I put two views in the layout), but it does not change anything. Here's a section of my onCreate method that seems to cause a 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 searched everywhere and no one else seemed to have this problem. Any advice? I am using the latest versions of google-play-services-lib and BaseGameUtils.

+6
source share
1 answer

I get it. It turns out that all I had to do was transfer the call to gameHelper.setup to the very end of the onCreate method, and it works fine.

+2
source

Source: https://habr.com/ru/post/975508/


All Articles