-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[2001]查询更新失败:未知错误 #11
Comments
我也出现这个问题,6.0手机 |
是因为解析得到的 UpdateInfo 为 null |
在4.4手机上正常,6.0就是这样了 |
看代码,只有解析返回的 UpdateInfo 为 null时才会提示 CHECK_UNKNOWN
|
代码是这样,info却是返回null了,在4.4不是null。 |
你看下logcat有没有异常信息吧 |
提示未知错误,如果是我的问题的话请告诉我。 |
我也出现这个问题 [2001]查询更新失败:未知错误 6.0以上 |
好像跟mCheckUrl这个参数有关,好像只能写Demo中http://client.waimai.baidu.com/message/updatetag的这个参数 |
好像是这样,不过这个mCheckUrl并没有什么卵用,你可以请求更新接口然后自己解析成updateInfo类型的数据,非常感谢 |
@gsy450896356 如果不用Demo的mCheckUrl 要怎么写?我还没找到方法 能否给我看下你的代码 |
@zzm123456 private void update() {
|
@czy1121 如果修改Demo中的mCheckUrl的值导致6.0以上的机子报[2001]查询更新失败:未知错误 。能否修复下 |
建议看下源码 @Override
protected Void doInBackground(Void... params) {
HttpURLConnection connection = null;
try {
connection = (HttpURLConnection) new URL(mAgent.getUrl()).openConnection();
connection.setRequestProperty("Accept", "application/json");
connection.connect();
if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
mAgent.parse(UpdateUtil.readString(connection.getInputStream()));
}
} catch (IOException e) {
e.printStackTrace();
mAgent.setError(new UpdateError(UpdateError.CHECK_NETWORK_IO));
} finally {
if (connection != null) {
connection.disconnect();
}
}
return null;
} |
@zzm123456 @gsy450896356 建议检查一下请求的http status code,也许是status code 不为200导致跳过了解析 |
@czy1121 如果我不想setUrl 因为我们自己服务端自己会做版本对比 我只需要对话框和后续的下载安装功能,好像没有办法调用吧,好像一定要传有效的url |
@zzm123456 不冲突的吧,UpdateChecker 是用的get请求,它会获取你服务器返回的结果,在UpdateAgent.InfoParser 里把它转成 UndateInfo 就好了 |
[2001]查询更新失败:未知错误
The text was updated successfully, but these errors were encountered: