【问题标题】:Android - Google Play Game Service, Could not find method android.view.View.getDisplayAndroid - Google Play 游戏服务,找不到方法 android.view.View.getDisplay
【发布时间】:2013-07-23 09:09:52
【问题描述】:

登录弹出窗口未显示。 logcat 说

  Could not find method android.view.View.getDisplay, referenced from method com.google.android.gms.internal.bn$b.b
   VFY: unable to resolve virtual method 3169: Landroid/view/View;.getDisplay ()Landroid/view/Display;
   VFY: replacing opcode 0x6e at 0x0009

我只在真机上进行了测试,三星 S3 是 Android 4.1.2 (API 16)。 getDisplay() 方法需要 API 17。我尝试了“扩展 FragmentActivity”,但 support-v4 库中没有 getDisplay()。 GamesClient.Builder.setViewForPopups() 要么无济于事。 Google Game Play Service 应该按照要求从 Android 2.2 开始支持。

我所有的开发工具都是最新的。 google-play-lib 3.1.59 (744626-30),SDK 22.0.4。

非常感谢。

【问题讨论】:

  • 您如何将 Google Play 服务集成到您的项目中?您使用的是 Eclipse 还是 Android Studio/Gradle?

标签: android google-play-services google-play-games


【解决方案1】:

试试这些步骤:

  1. 右键单击项目,然后选择属性
  2. 转到 Java 构建路径顺序和导出。
  3. 如果您将库放在那里,请勾选“Android 私有库”,或者勾选您的库。

然后清理并构建。

【讨论】:

    【解决方案2】:

    您能发布更完整的日志吗?这些行可能不是登录窗口未显示在您的应用上的原因 (see this other post which shows those lines in the logs and yet was able to proceed)。

    其他可能对您有帮助的事情:

    【讨论】:

    • @Nick(赏金所有者),回答您有关 Google Play 库中 API 17 使用的问题:Dalvik 经常抱怨 APK 中缺少方法。只要我们在执行代码期间没有调用这些方法(很可能使用像 if (sdk < android.os.Build.VERSION_CODES.HONEYCOMB) 这样的检查或我认为由 Google 完成的类似操作),这应该不是问题。
    【解决方案3】:

    尝试在不同版本的 Android 上进行测试,因为我在 Android 4.1.2 上测试我的应用程序时也遇到了一些问题。此外,如果您将一些代码放在出现错误的地方会更好。它有助于更​​快地解决问题。

    另外,如果问题得到解决,请告诉我们。对遇到同样问题的任何人都会很有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-17
      • 1970-01-01
      • 2014-02-02
      • 1970-01-01
      • 2014-12-17
      • 1970-01-01
      • 2013-07-31
      相关资源
      最近更新 更多