Android Twitter4J(xAuth):一台设备可以工作,一台设备不能
这是堆栈跟踪:
06-16 14:44:20.462 5526 5535 W System.err: **The screen name / password combination seems to be invalid.** Relevant discussions can be on the Internet at:
06-16 14:44:20.462 5526 5535 W System.err: http://www.google.co.jp/search?q=96430884 or
06-16 14:44:20.462 5526 5535 W System.err: http://www.google.co.jp/search?q=000024ea
06-16 14:44:20.462 5526 5535 W System.err: TwitterException{exceptionCode=[96430884-000024ea 9aae86e9-10c613ce 9aae86e9-10c613a4], statusCode=-1, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.3}
06-16 14:44:20.462 5526 5535 W System.err: at twitter4j.auth.OAuthAuthorization.getOAuthAccessToken(OAuthAuthorization.java:181)
06-16 14:44:20.462 5526 5535 W System.err: at twitter4j.TwitterBaseImpl.getOAuthAccessToken(TwitterBaseImpl.java:299)
06-16 14:44:20.462 5526 5535 W System.err: at com.outware.wineregions.activities.NameAndPasswordActivity$2.doInBackground(NameAndPasswordActivity.java:107)
06-16 14:44:20.462 5526 5535 W System.err: at com.outware.wineregions.activities.NameAndPasswordActivity$2.doInBackground(NameAndPasswordActivity.java:1)
06-16 14:44:20.462 5526 5535 W System.err: at android.os.AsyncTask$2.call(AsyncTask.java:185)
06-16 14:44:20.462 5526 5535 W System.err: at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
06-16 14:44:20.462 5526 5535 W System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:137)
06-16 14:44:20.462 5526 5535 W System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
06-16 14:44:20.462 5526 5535 W System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
06-16 14:44:20.462 5526 5535 W System.err: at java.lang.Thread.run(Thread.java:1096)
06-16 14:44:20.462 5526 5535 W System.err: **Caused by: Host is unresolved: api.twitter.com:443** Relevant discussions can be on the Internet at:
06-16 14:44:20.462 5526 5535 W System.err: http://www.google.co.jp/search?q=9aae86e9 or
06-16 14:44:20.462 5526 5535 W System.err: http://www.google.co.jp/search?q=10c613ce
06-16 14:44:20.462 5526 5535 W System.err: TwitterException{exceptionCode=[9aae86e9-10c613ce 9aae86e9-10c613a4], statusCode=-1, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.3}
06-16 14:44:20.470 5526 5535 W System.err: at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:204)
06-16 14:44:20.470 5526 5535 W System.err: at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:65)
06-16 14:44:20.470 5526 5535 W System.err: at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:102)
06-16 14:44:20.470 5526 5535 W System.err: at twitter4j.auth.OAuthAuthorization.getOAuthAccessToken(OAuthAuthorization.java:174)
06-16 14:44:20.470 5526 5535 W System.err: ... 9 more
06-16 14:44:20.470 5526 5535 W System.err: Caused by: java.net.UnknownHostException: Host is unresolved: api.twitter.com:443
06-16 14:44:20.470 5526 5535 W System.err: at java.net.Socket.connect(Socket.java:1037)
06-16 14:44:20.470 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:62)
06-16 14:44:20.470 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager$ConnectionPool.getHttpConnection(HttpConnectionManager.java:145)
06-16 14:44:20.478 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager.getConnection(HttpConnectionManager.java:67)
06-16 14:44:20.478 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getHTTPConnection(HttpURLConnection.java:821)
06-16 14:44:20.478 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:807)
06-16 14:44:20.478 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection$HttpsEngine.connect(HttpsURLConnection.java:395)
06-16 14:44:20.478 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.sendRequest(HttpURLConnection.java:1224)
06-16 14:44:20.478 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.doRequestInternal(HttpURLConnection.java:1558)
06-16 14:44:20.478 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.doRequest(HttpURLConnection.java:1551)
06-16 14:44:20.478 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1145)
06-16 14:44:20.478 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection.getOutputStream(HttpsURLConnection.java:262)
06-16 14:44:20.478 5526 5535 W System.err: at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:162)
它在一台设备上运行,但在另一台设备上,它会生成上述错误,是的,该应用程序已被批准在 iPhone 上使用 xauth,我确信密钥/秘密对没有问题因为它可以在另一台设备上运行。
有人可以给我任何建议吗?谢谢!
Here is the stacktrace:
06-16 14:44:20.462 5526 5535 W System.err: **The screen name / password combination seems to be invalid.** Relevant discussions can be on the Internet at:
06-16 14:44:20.462 5526 5535 W System.err: http://www.google.co.jp/search?q=96430884 or
06-16 14:44:20.462 5526 5535 W System.err: http://www.google.co.jp/search?q=000024ea
06-16 14:44:20.462 5526 5535 W System.err: TwitterException{exceptionCode=[96430884-000024ea 9aae86e9-10c613ce 9aae86e9-10c613a4], statusCode=-1, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.3}
06-16 14:44:20.462 5526 5535 W System.err: at twitter4j.auth.OAuthAuthorization.getOAuthAccessToken(OAuthAuthorization.java:181)
06-16 14:44:20.462 5526 5535 W System.err: at twitter4j.TwitterBaseImpl.getOAuthAccessToken(TwitterBaseImpl.java:299)
06-16 14:44:20.462 5526 5535 W System.err: at com.outware.wineregions.activities.NameAndPasswordActivity$2.doInBackground(NameAndPasswordActivity.java:107)
06-16 14:44:20.462 5526 5535 W System.err: at com.outware.wineregions.activities.NameAndPasswordActivity$2.doInBackground(NameAndPasswordActivity.java:1)
06-16 14:44:20.462 5526 5535 W System.err: at android.os.AsyncTask$2.call(AsyncTask.java:185)
06-16 14:44:20.462 5526 5535 W System.err: at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
06-16 14:44:20.462 5526 5535 W System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:137)
06-16 14:44:20.462 5526 5535 W System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
06-16 14:44:20.462 5526 5535 W System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
06-16 14:44:20.462 5526 5535 W System.err: at java.lang.Thread.run(Thread.java:1096)
06-16 14:44:20.462 5526 5535 W System.err: **Caused by: Host is unresolved: api.twitter.com:443** Relevant discussions can be on the Internet at:
06-16 14:44:20.462 5526 5535 W System.err: http://www.google.co.jp/search?q=9aae86e9 or
06-16 14:44:20.462 5526 5535 W System.err: http://www.google.co.jp/search?q=10c613ce
06-16 14:44:20.462 5526 5535 W System.err: TwitterException{exceptionCode=[9aae86e9-10c613ce 9aae86e9-10c613a4], statusCode=-1, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.3}
06-16 14:44:20.470 5526 5535 W System.err: at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:204)
06-16 14:44:20.470 5526 5535 W System.err: at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:65)
06-16 14:44:20.470 5526 5535 W System.err: at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:102)
06-16 14:44:20.470 5526 5535 W System.err: at twitter4j.auth.OAuthAuthorization.getOAuthAccessToken(OAuthAuthorization.java:174)
06-16 14:44:20.470 5526 5535 W System.err: ... 9 more
06-16 14:44:20.470 5526 5535 W System.err: Caused by: java.net.UnknownHostException: Host is unresolved: api.twitter.com:443
06-16 14:44:20.470 5526 5535 W System.err: at java.net.Socket.connect(Socket.java:1037)
06-16 14:44:20.470 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:62)
06-16 14:44:20.470 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager$ConnectionPool.getHttpConnection(HttpConnectionManager.java:145)
06-16 14:44:20.478 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager.getConnection(HttpConnectionManager.java:67)
06-16 14:44:20.478 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getHTTPConnection(HttpURLConnection.java:821)
06-16 14:44:20.478 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:807)
06-16 14:44:20.478 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection$HttpsEngine.connect(HttpsURLConnection.java:395)
06-16 14:44:20.478 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.sendRequest(HttpURLConnection.java:1224)
06-16 14:44:20.478 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.doRequestInternal(HttpURLConnection.java:1558)
06-16 14:44:20.478 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.doRequest(HttpURLConnection.java:1551)
06-16 14:44:20.478 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1145)
06-16 14:44:20.478 5526 5535 W System.err: at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection.getOutputStream(HttpsURLConnection.java:262)
06-16 14:44:20.478 5526 5535 W System.err: at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:162)
It works on one device, but on another device, it generates the above error, and yes, this app has been approved to use xauth on iPhone and I'm sure there is no problem with the key/secret pair as it works on another device.
Can anyone give me any suggestion? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们遇到了类似的问题,尽管原因可能与您的不同。
在我们的例子中,我们设置了 2 个 Twitter 应用程序,一个用于生产,另一个用于测试。生产启用了 xAuth,而测试则没有。安装了生产应用程序的设备可以毫无问题地登录,因为显然它们正在访问启用 xAuth 的 Twitter 应用程序。而安装了测试应用程序的设备会获得与您的设备相同的堆栈跟踪。
We had a similar problem though the cause may be different from yours.
In our case we have setup 2 Twitter applications, one for Production and another for Test. Production has xAuth enabled and Test doesn't. Devices that have the production app installed can sign in without any problem because obviously they are hitting an xAuth-enabled Twitter app. Whereas devices that have the test app installed get the same stack trace as yours.
如果 Twitter 客户端上的时钟(严重)不同步,您也会收到此错误。
我刚刚遇到了这个问题,我的手机关机了几周,内部时钟设置为 1980 年 1 月 1 日。正确设置时钟解决了这个问题。
You will also get this error if the clock on the Twitter client is (massively) out of sync.
I just ran into this, where my handset was off for several weeks and the internal clock was set to Jan 1st 1980. Setting the clock correctly fixed the issue.