我想使用 twilio api 从 android 设备发送短信。我使用该代码 -
TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);
params = new HashMap<String,String>();
params.put("From","+1 205-490-2571");
params.put("To","9614549499");
params.put("Body", "Bad news , the server is down and it needs your help");
Account acct = client.getAccount();
SmsFactory smsFactory = acct.getSmsFactory();
Sms sms = null;
try {
sms = smsFactory.create(params);
} catch (TwilioRestException e) {
e.printStackTrace();
}
我在初始化 TwilioRestClient 对象时遇到错误。我收到此错误
10-29 10:07:48.511: E/AndroidRuntime(354): FATAL EXCEPTION: main
10-29 10:07:48.511: E/AndroidRuntime(354): java.lang.NoSuchMethodError: org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager.<init>
10-29 10:07:48.511: E/AndroidRuntime(354): at com.twilio.sdk.TwilioRestClient.<init>(TwilioRestClient.java:139)
10-29 10:07:48.511: E/AndroidRuntime(354): at com.twilio.sdk.TwilioRestClient.<init>(TwilioRestClient.java:110)
10-29 10:07:48.511: E/AndroidRuntime(354): at com.twilio.twiliomessage.TwilioActivity$1.onClick(TwilioActivity.java:81)
10-29 10:07:48.511: E/AndroidRuntime(354): at android.view.View.performClick(View.java:2485)
10-29 10:07:48.511: E/AndroidRuntime(354): at android.view.View$PerformClick.run(View.java:9080)
10-29 10:07:48.511: E/AndroidRuntime(354): at android.os.Handler.handleCallback(Handler.java:587)
10-29 10:07:48.511: E/AndroidRuntime(354): at android.os.Handler.dispatchMessage(Handler.java:92)
10-29 10:07:48.511: E/AndroidRuntime(354): at android.os.Looper.loop(Looper.java:123)
10-29 10:07:48.511: E/AndroidRuntime(354): at android.app.ActivityThread.main(ActivityThread.java:3683)
10-29 10:07:48.511: E/AndroidRuntime(354): at java.lang.reflect.Method.invokeNative(Native Method)
10-29 10:07:48.511: E/AndroidRuntime(354): at java.lang.reflect.Method.invoke(Method.java:507)
10-29 10:07:48.511: E/AndroidRuntime(354): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-29 10:07:48.511: E/AndroidRuntime(354): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-29 10:07:48.511: E/AndroidRuntime(354): at dalvik.system.NativeStart.main(Native Method)