【发布时间】:2023-03-15 10:24:01
【问题描述】:
当使用 nexmo api 3.0+ 版本(不使用 4.0+ 因为需要 android 版本 8 api 27 )和 android 版本 6 api 23 时
我无法发送短信,因为它总是给出上述错误:No static field DEF_CONTENT_CHARSET of type Ljava/nio/charset/Charset;在类 Lorg/apache/http/protocol/HTTP;
发送短信代码:
AuthMethod auth = new TokenAuthMethod(APIKey, APISecret);
NexmoClient client = new NexmoClient(auth);
TextMessage message = new TextMessage(fromRecipient, toRecipient, messageContent);
SmsSubmissionResult[] response = client.getSmsClient().submitMessage(message);
for (SmsSubmissionResult responseMessage : response) {
System.out.println(responseMessage);
}
我导入了以下内容:
implementation 'org.apache.httpcomponents:httpclient:4.5+'
implementation 'org.apache.httpcomponents:httpcore:4.4+'
但它仍在查看旧的 httpclient 而不是导入的 httpclient
有没有办法强制使用导入的 http 客户端/核心库而不是旧库?
【问题讨论】:
标签: java android android-studio httpclient nexmo