创建房间时 CONNECTION_FAILED Google Play 服务

Posted

技术标签:

【中文标题】创建房间时 CONNECTION_FAILED Google Play 服务【英文标题】:CONNECTION_FAILED while creating room Google Play Services 【发布时间】:2013-11-13 07:20:13 【问题描述】:

这是我对 quickGame 的功能

Bundle autoMatchCriteria = RoomConfig.createAutoMatchCriteria(1, 1, 0);
RoomConfig.Builder rtmConfigBuilder = RoomConfig.builder(this);
rtmConfigBuilder.setMessageReceivedListener(this);
rtmConfigBuilder.setRoomStatusUpdateListener(this);
rtmConfigBuilder.setAutoMatchCriteria(autoMatchCriteria);
switchToScreen(R.id.screen_wait);
//keepScreenOn();
//resetGameVars();
getGamesClient().createRoom(rtmConfigBuilder.build());

和 onRoomCreated 游戏停止的地方

@Override
    public void onRoomCreated(int statusCode, Room room) 
        Log.d(TAG, "onRoomCreated(" + statusCode + ", " + room + ")");
        if (statusCode != GamesClient.STATUS_OK) 
            Log.e(TAG, "*** Error: onRoomCreated, status " + statusCode);
            showGameError();
            return;
        
        showWaitingRoom(room);
    

我得到statusCode = 7000STATUS_REAL_TIME_CONNECTION_FAILEDroom = null 所以我认为问题出在quickGame 函数中。

D/Multiplayer(24221): Sign-in succeeded.
D/Multiplayer(24221): GameHelper: onActivityResult: req=10001, resp=RESULT_CANCELED
D/Multiplayer(24221): GameHelper: onActivityResult: request code not meant for us. Ignoring.
W/Multiplayer(24221): *** invitation inbox UI cancelled, 0
D/Multiplayer(24221): GameHelper: onActivityResult: req=10000, resp=RESULT_OK
D/Multiplayer(24221): GameHelper: onActivityResult: request code not meant for us. Ignoring.
D/Multiplayer(24221): Select players UI succeeded.
D/Multiplayer(24221): Invitee count: 1
D/Multiplayer(24221): Creating room...
D/Multiplayer(24221): Room created, waiting for it to be ready...
D/Multiplayer(24221): onRoomCreated(7000, null)
E/Multiplayer(24221): *** Error: onRoomCreated, status 7000
W/ResourceType(24221): getEntry failing because entryIndex 13 is beyond type entryCount 1
W/ResourceType(24221): Failure getting entry for 0x7f0b000d (t=10 e=13) in package 0 (error -2147483647)
E/GooglePlayServicesUtil(24221): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
W/PicturePileLayerContent(24221): Warning: painting PicturePile without content!
W/PicturePileLayerContent(24221): Warning: painting PicturePile without content!
W/PicturePileLayerContent(24221): Warning: painting PicturePile without content!

我将我的源代码与谷歌示例进行比较,但没有效果 我在平板电脑上安装了 Google Play Services 4.0 和最新的 sdk

【问题讨论】:

【参考方案1】:

您是否在 Google Play 开发者控制台中开启了多人游戏?

启用多人游戏支持

要集成游戏服务多人游戏支持,例如玩家匹配,您必须启用多人游戏设置。目前仅支持安卓实时多人游戏。

启用多人游戏:

从 Google Play 开发者控制台打开带有游戏服务的游戏页面,然后选择您的游戏。 打开游戏的链接应用页面,然后将多人游戏设置切换为开启。 单击“另存为草稿”以存储您的设置。

来源:https://developers.google.com/games/services/console/configuring#enabling_multiplayer_support

【讨论】:

【参考方案2】:

只是想让你知道 - 我知道我的问题是什么......好吧......

在我的例子中,问题出在 AdMob - 它最初是作为一个单独的库集成的,当我将 GooglePlus 添加到游戏中时,开始在控制台中看到很多东西。

我很困惑,问题出在 GooglePlus(抛出您看到的有关缺少资源的消息) - 但正是 AdMob 部分正在这样做。

尽管如此,即使在弄清楚这一点之后 GooglePlus 操作也无法正常工作。

最奇怪的是它们可以在旧的 HTC Sense (2.2) 下工作,但不能在任何 4.x 设备上工作..

我刚刚撕掉了整个东西 - 花了两天时间......为了一个 +1 按钮。

【讨论】:

【参考方案3】:

我从互联网上安装了 google play services.apk,这就是原因。我等待来自 Google Play 的更新,现在一切正常 :)

【讨论】:

以上是关于创建房间时 CONNECTION_FAILED Google Play 服务的主要内容,如果未能解决你的问题,请参考以下文章

如何根据用户输入创建动态 CSS

为啥我突然不能再创建房间了?

socket.io 创建动态房间

比赛开始创建房间后,Photon Unity中所有人离开后房间会消失吗?

Photon Engine:客户端无法连接到现有房间并创建同一个房间

实时多人房间创建进度卡在 20%