Comments (8)
我大概猜到是为什么了,可能是屏幕横竖屏切换的时候,资源被回收了
from xupdate.
已修复:
49b9261
from xupdate.
理论上IUpdateProxy是不可能为null的,你得把错误发生的详情仔细描述清楚
from xupdate.
你好,感谢您的回复。这是友盟统计的数据,我没有复现,但是这个崩溃数量是最高的。截图已发送到您的邮箱,请查收
from xupdate.
@tanglufeng 貌似并没有收到你的邮件
from xupdate.
估计是到垃圾箱了,麻烦您再找找。github怎么不能传图啊
from xupdate.
app
XUpdate.get()
.debug(false)
.isWifiOnly(false) //默认设置只在wifi下检查版本更新
.isGet(true) //默认设置使用get请求检查版本
.param("VersionCode", UpdateUtils.getVersionCode(this)) //设置默认公共请求参数
.param("AppKey", getPackageName())
.setOnUpdateFailureListener(new OnUpdateFailureListener() { //设置版本更新出错的监听
@Override
public void onFailure(UpdateError error) {
if (!MyApplication.isHome) {
ToastUtil.showShortToast(mContext, error.toString());
}
}
})
.setIUpdateHttpService(new OKHttpUpdateHttpService()) //这个必须设置!实现网络请求功能。
.init(this); //这个必须初始化
首页
String mUpdateUrl = Constant.WEBROOT + "api/version";
XUpdate.newBuild(MainActivity.this)
.updateUrl(mUpdateUrl)
.update();
接口实现
public class OKHttpUpdateHttpService implements IUpdateHttpService {
@OverRide
public void asyncGet(@nonnull String url, @nonnull Map<String, Object> params, @nonnull final Callback callBack) {
OkGo.get(url).params(transform(params)).execute(new StringCallback() {
@OverRide
public void onSuccess(Response response) {
callBack.onSuccess(response.body());
}
@Override
public void onError(Response<String> response) {
callBack.onError(response.getException());
}
});
}
@Override
public void asyncPost(@NonNull String url, @NonNull Map<String, Object> params, @NonNull final Callback callBack) {
OkGo.<String>post(url)
.params(transform(params))
.execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
callBack.onSuccess(response.body());
}
@Override
public void onError(Response<String> response) {
callBack.onError(response.getException());
}
});
}
/**
* 下载
*
* @param url 下载地址
* @param path 文件保存路径
* @param fileName 文件名称
* @param callback 回调
*/
@Override
public void download(@NonNull String url, @NonNull String path, @NonNull String fileName, @NonNull final DownloadCallback callback) {
OkGo.<File>get(url).execute(new FileCallback(path, fileName) {
@Override
public void onSuccess(Response<File> response) {
callback.onSuccess(response.body());
}
@Override
public void onError(Response<File> response) {
callback.onError(response.getException());
}
@Override
public void onStart(Request<File, ? extends Request> request) {
callback.onStart();
}
@Override
public void downloadProgress(Progress progress) {
callback.onProgress(progress.fraction, progress.totalSize);
}
});
}
@Override
public void cancelDownload(@NonNull String url) {
}
private Map<String, String> transform(Map<String, Object> params) {
Map<String, String> map = new TreeMap<>();
for (Map.Entry<String, Object> entry : params.entrySet()) {
map.put(entry.getKey(), entry.getValue().toString());
}
return map;
}
}
from xupdate.
对,刚刚已经复现了。谢谢修复。
from xupdate.
Related Issues (20)
- 空壳模板TemplateAppProject运行时在版本检测解析流程中-抛异常 HOT 2
- 希望初始化的时候能把网络相关参数配置去掉 HOT 1
- 如果只需要下载APK功能和后台下载功能
- 发生android.util.SuperNotCalledException异常 HOT 1
- 使用这个库没办法后台显示Notification的下载进度 HOT 2
- java.lang.RuntimeException: Unable to get provider com.xuexiang.xupdate.utils.UpdateFileProvider HOT 2
- 下载出现异常如果是强制更新能否不关闭弹窗,可以点击重新下载 HOT 1
- 请问请求头如何设置? HOT 1
- 鸿蒙系统更新问题,提示不能安装 HOT 1
- 当请求接口处于超时状态下,多次点击下载会出现ANR 问题 HOT 1
- Android12无法更新&下载安装包(单独)&安装软件 HOT 1
- 可以在App更新完成后再自动启动App吗? HOT 1
- 2.1.3版本被google play拒了 HOT 5
- 啥时候能支持rxjava3 HOT 1
- 可以直接从构建UpdateEntity版本更新实体开始使用框架吗? HOT 1
- 安卓4.4.2无法使用,报错:java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. HOT 1
- 能否支持在更新信息上,添加网页超链接,用户点击链接后,可通过浏览器打开链接。 HOT 1
- 安装后自动删除apk包 HOT 1
- targetSdk > 30时且使用后台更新模式,显示apk下载完成通知时会抛出异常
- 第一次授权后,返回应用,不会自动安装 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xupdate.