AlexLiuSheng / CheckVersionLib

版本检测升级(更新)库。an auto check version library(app update) on Android
https://github.com/AlexLiuSheng/CheckVersionLib
2.67k stars 484 forks source link

2.4_androidx--下载失败,一直提示失败无法使用 华为p10 7.0手机 编译版本29 #326

Closed hardgit closed 4 years ago

hardgit commented 4 years ago

2.4_androidx--下载失败,一直提示失败 华为p10 7.0手机 编译版本29 也设置了自定义地址 使用方式 HttpParams httpParams = new HttpParams(); httpParams.put("appType","1");//type = 1代表android设备 httpParams.put("versionCode", AppConfig.getAppVersion(this));// 版本号 Log.e("loadurl",UpdateLoaderURL); AllenVersionChecker .getInstance() .requestVersion() .setRequestMethod(HttpRequestMethod.POSTJSON) .setRequestParams(httpParams) .setRequestUrl(UpdateLoaderURL) .request(new RequestVersionListener() {

                @androidx.annotation.Nullable
                @Override
                public UIData onRequestVersionSuccess(DownloadBuilder downloadBuilder, String result) {
                   LogUtils.e("updataJson"+result);
                    Gson gson = new Gson();
                    UpdataLoaderBean updataLoaderBean = gson.fromJson(result, UpdataLoaderBean.class);
                    UpdataLoaderBean.BodyBean.SystemTerminalVersionBean data = updataLoaderBean.getBody().getSystemTerminalVersion();
                    UIData uiData = UIData
                            .create()
                            .setDownloadUrl("https://imtt.dd.qq.com/16891/apk/5A74ACC0974A2402ACE5EE6CFAAE6484.apk")
                            .setTitle("发现新版本啦!")
                            .setContent(data.getUpdateContent());
                    //放一些其他的UI参数,拿到后面自定义界面使用

// uiData.getVersionBundle().putString("key", "your value"); return uiData; }

                @Override
                public void onRequestVersionFailure(String message) {
                    LogUtils.e("result"+message);
                }
            })
             .setDownloadAPKPath(this.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS).getPath() +"/")
            .executeMission(this);
AlexLiuSheng commented 4 years ago

看下控制台信息

hardgit commented 4 years ago

@AlexLiuSheng 已解决,原因是公司内网代理不能访问外网。。