android - 无法解析参考:Xamarin 中的“条纹”
问题描述
我正在尝试将 Stripe 付款合并到我的 Xamarin 应用程序中。我已经安装了最新的 Stripe NuGet 包,并在我的 .cs 中包含了以下代码:
using System;
using System.Collections.Generic;
using Stripe;
using Xamarin.Forms;
namespace CampaignFinanceNew
{
public partial class CreditCardProcess : ContentPage
{
StripeClient paymentClient = new StripeClient("[test key here]");
public CreditCardProcess()
{
InitializeComponent();
CreditCard currentCard = new CreditCard();
currentCard.Number = creditCardNumber.Text;
currentCard.ExpMonth = Convert.ToInt32(ccExpiryMonth.Text);
currentCard.ExpYear = Convert.ToInt32(ccExpiryYear.Text);
StripeObject newToken = paymentClient.CreateCardToken(currentCard);
}
}
}
当我构建项目时,它给了我以下错误:
错误 XA2002:无法解析引用:Stripe
,由 引用CampaignFinanceNew
。请为 . 添加 NuGet 包或程序集引用Stripe
,或删除对CampaignFinanceNew
. (XA2002) (CampaignFinanceNew.Android)
我尝试将 Stripe 包添加到我的 iOS 和 Android 项目中,但它告诉我它不兼容。我该怎么办?我会更好地为 iOS 和 Android 单独实现它,然后通过 DependencyService 访问它吗?
解决方案
经过进一步研究,似乎有 2 种不同的 Stripe NuGet 包,一种是专门为 .NET 应用程序编写的(与我使用的相反)。我已经下载了新的软件包,现在一切似乎都很好。
推荐阅读
- nginx - Nginx 无法通过 Ansible 重启
- php - 有没有办法摆脱 PHP 中复杂变量的丑陋重复提及?
- python - 如何在一个列表中得出有效的方法
- mysql - mariadb 主服务器包含许多(和旧的)中继日志文件
- javascript - 如何在内容可编辑表中捕获键盘事件?
- git - 在我的本地存储库中找不到命令 gitk
- python - Django render() 没有将变量传递给模板?
- javascript - 为多个子菜单动态设置 useState
- reactjs - 使用 setInterval 在 Redux Action Creators 中获取歌曲中的位置
- c++ - Do I need to initialize base class in virtual inheritance classes' constructors for diamond inheritanceproblem?