AONE 问题总结

1、OAuth retrieveRequestToken异常

用OAuth进行验证时,报下面的错误,网上排查良久无方。

oauth.signpost.exception.OAuthExpectationFailedException: Request token or token secret not set in server reply. The service provider you use is probably buggy.

 后发现是应用的Consumer Key、Consumer secret

配错了,写成了

Access Token、Access Token Secret

汗。。

 

2、新浪发布微博出现如下异常

java.lang.IllegalStateException: Neither user ID/password combination nor OAuth consumer key/secret combination supplied

 出错代码

weibo4android.Status updateResult = weibo.updateStatus(StringUtils.utf8Encode(status));

原因:

未提供comsumer key 

解决方法:

        System.setProperty("weibo4j.oauth.consumerKey", "CONSUMER_KEY");
        System.setProperty("weibo4j.oauth.consumerSecret", "CONSUMER_SECRET");
 

 

3、发布sohu微博时,报如下异常

 

java.io.IOException: Received authentication challenge is null

 出错代码

            HttpURLConnection request = (HttpURLConnection)url.openConnection();
            request.setDoOutput(true);
            request.setRequestMethod("POST");
            HttpParameters para = new HttpParameters();
            para.put("status", URLEncoder.encode("第一条", "utf-8").replaceAll("\\+", "%20"));
            consumer.setAdditionalParameters(para);
            consumer.sign(request);
            OutputStream ot = request.getOutputStream();
            ot.write(("status=" + URLEncoder.encode("中 文", "utf-8")).replaceAll("\\+", "%20").getBytes());
            ot.flush();
            ot.close();
            System.out.println("Sending request...");
            request.connect();
            System.out.println("Response: " + request.getResponseCode() + " " + request.getResponseMessage());

 上述代码中request.getResponseCode()时报异常

解决方法:

未解决,第二天重新执行错误消失。。

 

 

3、在android开发中我们需要充分利用线程及消息队列来处理需要长时间响应的操作,防止ui假死

 

4、腾讯微博认证异常

像https://open.t.qq.com/cgi-bin/request_token获取未授权的access token出现如下异常

java.lang.Exception: javax.net.ssl.SSLHandshakeException: org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate signature.

 原因应该是以上请求的ssl证书已经不可用,将https改为http即可,如http://open.t.qq.com/cgi-bin/request_token

 

5、Conversion to Dalvik format failed with error 1

网上有各种原因,有project clean解决的,有修改android sdk版本解决的

我这次碰到的原因是因为依赖的外部包冲突了,同时依赖了A、B两个jar包,而A包已经在B包中

解决方法:去掉对B包的依赖

 

你可能感兴趣的:(one)