使用翻新从服务器获取数据。 正在调试模式下运行,但该应用在生产中崩溃了。
代码:-
compositeDisposable.add(Observable.range(0, Integer.MAX_VALUE)
// Get each page in order.
.concatMap(integer -> {
return apiInterface.postGetFeed(membersIds, lastFeedId);
})
// Take every result up to and including the one where the next page index is null.
.takeUntil(result -> {
if(!result.getData().isEmpty())
lastFeedId = result.getData().get(result.getData().size() - 1).getId();
return result.getData().isEmpty();
})
.map(FeedResponse::getData)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribeWith(new DisposableObserver<List<Feed>>() {
@Override
public void onNext(List<Feed> feeds) {
Log.d("feed", "" + feeds);
memberDatabaseRepository.insertMemberList(feeds, lastFeedId);
}
@Override
public void onError(Throwable e) {
//error getting here
Log.d("feed", "error " + e.getMessage());
}
@Override
public void onComplete() {
memberDatabaseRepository.getAllFeed(FeedFragment.this);
shimmerViewContainerFeed.stopShimmer();
shimmerViewContainerFeed.setVisibility(View.GONE);
}
}
));
logcat:
2019-05-16 18:57:16.113 16757-16757/com.fitphilia.treadmill.trainer D/feed: error throw with null exception
2019-05-16 18:57:16.113 16757-16824/com.fitphilia.treadmill.trainer W/System.err: java.lang.NullPointerException: throw with null exception
2019-05-16 18:57:16.113 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at c.e.a.a.g.r.a(Unknown Source:1)
2019-05-16 18:57:16.113 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at c.e.a.a.g.a.test(Unknown Source:4)
2019-05-16 18:57:16.113 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at e.b.e.e.d.r$a.a(Unknown Source:12)
2019-05-16 18:57:16.113 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at e.b.f.d.a(Unknown Source:60)
2019-05-16 18:57:16.113 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at e.b.e.e.d.b$b$a.a(Unknown Source:2)
2019-05-16 18:57:16.113 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at j.a.a.a$a.a(:1)
2019-05-16 18:57:16.113 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at j.a.a.c.b(:2)
2019-05-16 18:57:16.113 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at e.b.h.a(Unknown Source:10)
2019-05-16 18:57:16.113 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at j.a.a.a.b(Unknown Source:7)
2019-05-16 18:57:16.113 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at e.b.h.a(Unknown Source:10)
2019-05-16 18:57:16.113 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at e.b.e.e.d.b$b.d(Unknown Source:68)
2019-05-16 18:57:16.113 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at e.b.e.e.d.b$b.a(Unknown Source:35)
2019-05-16 18:57:16.113 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at e.b.e.e.d.l.b(Unknown Source:12)
2019-05-16 18:57:16.113 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at e.b.h.a(Unknown Source:10)
2019-05-16 18:57:16.113 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at e.b.e.e.d.b.b(:2)
2019-05-16 18:57:16.114 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at e.b.h.a(Unknown Source:10)
2019-05-16 18:57:16.114 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at e.b.e.e.d.r.b(Unknown Source:11)
2019-05-16 18:57:16.114 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at e.b.h.a(Unknown Source:10)
2019-05-16 18:57:16.114 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at e.b.e.e.d.j.b(Unknown Source:11)
2019-05-16 18:57:16.114 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at e.b.h.a(Unknown Source:10)
2019-05-16 18:57:16.114 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at e.b.e.e.d.q$b.run(Unknown Source:8)
2019-05-16 18:57:16.114 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at e.b.k$a.run(Unknown Source:9)
2019-05-16 18:57:16.114 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at e.b.e.g.i.call(:1)
2019-05-16 18:57:16.114 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2019-05-16 18:57:16.114 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
2019-05-16 18:57:16.114 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
2019-05-16 18:57:16.114 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
2019-05-16 18:57:16.114 16757-16824/com.fitphilia.treadmill.trainer W/System.err: at java.lang.Thread.run(Thread.java:764)
2019-05-16 18:57:16.309 16757-16757/com.fitphilia.treadmill.trainer I/zygote64: Deoptimizing java.lang.String i.b.a.d.b.a(i.b.a.t) due to JIT inline cache
我尝试将shrinkResources false
和minifyEnabled false
在生产中正常工作。
buildTypes {
release {
shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
但是为什么我在生产中执行shrinkResources true
和minifyEnabled true
时失败了?
答案 0 :(得分:0)
此遗失物
-dontwarn okhttp3.internal.platform.ConscryptPlatform
最终我的生产应用程序运行正常。