【问题标题】:Unexpected namespace prefix "wallet" found for tag fragment为标签片段找到了意外的命名空间前缀“钱包”
【发布时间】:2016-12-18 03:54:39
【问题描述】:

我正在尝试使用 Android Studio 将 Stripe 集成到我的 android 应用程序中。这是我的付款布局:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:wallet="http://schemas.android.com/apk/res-auto"
    tools:context="me.cm.ap.Payment">

<fragment
    android:id="@+id/wallet_fragment"
    android:name="com.google.android.gms.wallet.fragment.SupportWalletFragment"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    wallet:enviroment="test"
    wallet:fragmentMode="buyButton" />

所以在上面的代码中,我遇到了一个错误

wallet:enviroment="test"
wallet:fragmentMode="buyButton"

上面写着“标签片段的名称空间前缀为“钱包”......”

我已经加了

compile 'com.stripe:stripe-android:+'

到我的 gradle 模块,以及

<meta-data
        android:name="com.google.android.gms.wallet.api.enabled"
        android:value="true" />

到我的清单。

有什么问题,我该如何解决?

【问题讨论】:

    标签: java android stripe-payments android-pay


    【解决方案1】:

    如果您没有添加播放服务,请添加行并重建:

    compile 'com.google.android.gms:play-services:9.4.0'
    compile 'com.google.android.gms:play-services-wallet:9.4.0'
    

    之后,如果您仍然有错误,请更改付款布局,如下所示:

    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:wallet="http://schemas.android.com/apk/res-auto"
    android:id="@+id/wallet_fragment"
    android:name="com.google.android.gms.wallet.fragment.SupportWalletFragment"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    wallet:environment="test"
    wallet:fragmentMode="buyButton"/>
    

    【讨论】:

    • 我仍然遇到同样的错误。我一开始没有添加游戏服务钱包,但这并没有解决问题。我也尝试使用您的片段代码,但在钱包:环境和片段模式中仍然存在同样的错误。即使这些线带有下划线,我也可以运行应用程序,但我无法点击 android pay 按钮。
    猜你喜欢
    • 2013-05-03
    • 2013-02-01
    • 2013-06-01
    • 2014-04-05
    • 2013-09-11
    • 2013-05-28
    • 2013-07-04
    • 2013-05-06
    • 1970-01-01
    相关资源
    最近更新 更多