【问题标题】:Google +1 Button errors in implementation in Android在 Android 中实现 Google +1 按钮错误
【发布时间】:2013-07-15 10:17:36
【问题描述】:

我正在尝试将 Google +1 按钮添加到我的 Android 应用中。我有一些问题。我做了https://developers.google.com/+/mobile/android/getting-started 中的所有内容,接下来是https://developers.google.com/+/mobile/android/recommend 中的所有内容,但没有任何结果。当我使用来自第二个链接的应用程序代码时,我得到 NullPointerException... 它是如何工作的?谷歌犯了一个错误还是什么?此外,在导入 lib 后,在我放置 Google Plus 按钮时的布局中 - 我遇到了“无法实例化...”之类的错误。我该怎么办? sdk 中的示例应用程序不适合我 (NullPointerException?!) 。同样的事情是当我在 onResume 中调用 mPlusOneButton.initialize 之前初始化 mPlusOneButton 和 mPlusClient 时。有人搞定了吗?

【问题讨论】:

  • Logcat 输出可能有用。
  • 我无法运行应用程序,你在说什么logcat
  • 您提到了 NullPointerException。没有 logcat,你是如何观察到的?而且最好在帖子中提出单个问题而不是多个随机问题。

标签: android button google-plus-one


【解决方案1】:

我检查了示例代码,如果您在 findViewById 处收到 NullPointer 异常,我认为您忘记在 onCreate 中添加 setContentView 调用。

如果不查看代码和 logcat,真的无法猜测其他任何内容。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-18
    相关资源
    最近更新 更多