【问题标题】:Error integration PlusOneButton google api key错误集成PlusOneButton google api key
【发布时间】:2016-12-05 08:02:54
【问题描述】:

我这里有一个 ListView -:

<android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/main_refresh"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        tools:showIn="@layout/activity_main">

        <ListView
            android:id="@+id/list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:divider="@color/colorGrey"
            android:dividerHeight="5dp"
            tools:listitem="@layout/item" />

</android.support.v4.widget.SwipeRefreshLayout>

还有一个自定义项-:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:srcCompat="@mipmap/ic_image_black_24dp"
        android:contentDescription="@string/description" />

    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/app_name" />


    <com.google.android.gms.plus.PlusOneButton xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus"
        android:id="@+id/plus_one_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        plus:annotation="inline"
        plus:size="standard" />

</LinearLayout>

我推导出一个建议列表。我希望每个提案都有自己的按钮,但是当我添加一个没有键的按钮时,我没有然后就没有了!

dependencies {
    ...
    compile 'com.google.android.gms: play-services: 10.0.0'
    compile 'com.google.android.gms: play-services-auth: 10.0.0'
    compile 'com.google.android.gms: play-services-plus: 10.0.0'
}

预览给 item.xml 这个 -:

我在谷歌上搜索了这个问题并找到了一条评论,他在评论中写道,如果 juzat 库 com.google.android.gms: play-services 以上 7 版本,就会出现这个问题,所以我不认为谷歌投入了 Prodakshen 不工作的版本并且由于它已经超过 10 次,我怀疑他们更改了 api 密钥或类似的东西,我在此文档的帮助下从 google 集成了按钮:https://developers.google.com/+/mobile/android/recommend 是旧文档并且有新文档?

【问题讨论】:

    标签: android android-studio google-api google-play-services google-plus


    【解决方案1】:

    首先,请确保您已经enabled the Google+ API

    然后,您可能需要在更新项目中声明的依赖项时检查您是否已经使用最新版本的play-services 完成了Set Up Google Play Services

    Add Google Play Services to Your Project中所述,

    1. 在最新版本的 play-services 的依赖项下添加新的构建规则。

    确保每次更新 Google Play 服务时都更新版本号。

    您可能还想查看此(Google plusone (+1) button in Android application integration guide 了解更多信息。

    希望有帮助!

    【讨论】:

    • 谢谢,我都做了,全部更新,甚至缓存完全被推翻完全重建项目,除了按钮,一切正常:(
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-01
    • 2013-03-26
    • 2014-11-13
    • 1970-01-01
    相关资源
    最近更新 更多