У меня проблемы с sh в моем приложении. Я получил данные с Firebase crashlytics
. Я добавил модель телефона и отчет sh. Я делюсь HomeFragment
кодом. Я буду рад, если вы сможете мне помочь. С уважением.
HomeFragment. java:
public void onResponse(Call<Box> call, Response<Box> response) {
if (response.isSuccessful()){
if (response.body().getCategories().size()==0 && response.body().getSlides().size()==0 && response.body().getWallpapers().size()==0 && response.body().getPacks().size()==0 ){
recycle_view_home_fragment.setVisibility(View.GONE);
image_view_empty.setVisibility(View.VISIBLE);
linear_layout_page_error.setVisibility(View.GONE);
swipe_refreshl_home_fragment.setRefreshing(false);
}else{
if (response.body().getCategories().size()!=0) {
for (int i = 0; i < response.body().getCategories().size(); i++) {
categoryList.add(response.body().getCategories().get(i));
}
wallpaperList.add(new Wallpaper().setViewType(5));
}
if (response.body().getSlides().size()!=0) {
for (int i = 0; i < response.body().getSlides().size(); i++) {
if (i<15)
slideList.add(response.body().getSlides().get(i));
}
wallpaperList.add(new Wallpaper().setViewType(2));
}
if (response.body().getPacks().size()!=0) {
packList.add(new Pack().setViewType(2));
for (int i = 0; i < response.body().getPacks().size(); i++) {
packList.add(response.body().getPacks().get(i));
}
wallpaperList.add(new Wallpaper().setViewType(8));
}
if (categoryList.size()==0 && slideList.size()==0 && slideList.size()==0){
if (tabletSize) {
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
// return ((position + 1 ) % (lines_beetween_ads + 1 ) == 0 ) ? 4 : 1;
return ((position + 1 ) % (lines_beetween_ads + 1 ) == 0 ) ? 2 : 1;
}
});
} else {
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
// return ((position + 1 ) % (lines_beetween_ads + 1) == 0) ? 4 : 1;
return ((position + 1 ) % (lines_beetween_ads + 1) == 0) ? 2 : 1;
}
});
}
}
if (
(categoryList.size()==0 && slideList.size()==0 && packList.size() !=0) ||
(categoryList.size()==0 && slideList.size()!=0 && packList.size() ==0) ||
(categoryList.size()!=0 && slideList.size()==0 && packList.size() ==0)
){
if (native_ads_enabled){
if (tabletSize) {
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
// return ((position ) % (lines_beetween_ads + 1 ) == 0 || position == 0) ? 4 : 1;
return ((position ) % (lines_beetween_ads + 1 ) == 0 || position == 0) ? 2 : 1;
}
});
} else {
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
return ((position ) % (lines_beetween_ads + 1 ) == 0 || position == 0) ? 2 : 1;
}
});
}
}else {
if (tabletSize) {
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
// return ( position == 0) ? 4 : 1;
return ( position == 0) ? 2 : 1;
}
});
} else {
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
return ( position == 0) ? 2 : 1;
}
});
}
}
}
if(
(categoryList.size()==0 && slideList.size()!=0 && packList.size()!=0) ||
(categoryList.size()!=0 && slideList.size()==0 && packList.size()!=0) ||
(categoryList.size()!=0 && slideList.size()!=0 && packList.size()==0)
){
if (native_ads_enabled) {
if (tabletSize) {
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
// return ((position - 1) % (lines_beetween_ads + 1) == 0 || position == 0 || position == 1) ? 4 : 1;
return ((position - 1) % (lines_beetween_ads + 1) == 0 || position == 0 || position == 1) ? 2 : 1;
}
});
} else {
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
return ((position - 1) % (lines_beetween_ads + 1) == 0 || position == 0 || position == 1) ? 2 : 1;
}
});
}
}else {
if (tabletSize) {
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
// return ( position == 0 || position == 1) ? 4 : 1;
return ( position == 0 || position == 1) ? 2 : 1;
}
});
} else {
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
return ( position == 0 || position == 1) ? 2 : 1;
}
});
}
}
}
if(slideList.size()!=0 && categoryList.size()!=0 && packList.size()!=0 ){
if (native_ads_enabled) {
if (tabletSize) {
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
// return ((position - 2) % (lines_beetween_ads + 1) == 0 || position == 0 || position == 1 || position == 2) ? 4 : 1;
return ((position - 2) % (lines_beetween_ads + 1) == 0 || position == 0 || position == 1 || position == 2) ? 2: 1;
}
});
} else {
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
return ((position - 2) % (lines_beetween_ads + 1) == 0 || position == 0 || position == 1 || position == 2) ? 2 : 1;
}
});
}
}else {
if (tabletSize) {
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
//return ( position == 0 || position == 1 || position == 2 ) ? 4 : 1;
return position == 0 ? 2 : 1;
}
});
} else {
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
return ( position == 0 || position == 1 || position == 2) ? 2 : 1;
}
});
}
}
}
Galaxy Note 5 (Android 7.0)
Fatal Exception: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{14848e6 position=4 id=-1, oldPos=-1, pLpos:-1 no parent} androidx.recyclerview.widget.RecyclerView{d14f488 VFED..... ........ 0,0-1440,1965 #7f0a0163 app:id/recycle_view_search_activity}, adapter:com.modelsviewing.models.adapter.WallpaperAdapter@d9dbe21, layout:androidx.recyclerview.widget.GridLayoutManager@a9e3246, context:com.modelsviewing.models.ui.activities.SearchActivity@ea6a2ca
at androidx.recyclerview.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:5715)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5898)
at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:286)
at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:343)
at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:359)
at androidx.recyclerview.widget.GapWorker.prefetch(GapWorker.java:366)
at androidx.recyclerview.widget.GapWorker.run(GapWorker.java:397)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Galaxy A50 (Android 10)
Fatal Exception: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{ea082e3 position=12 id=-1, oldPos=-1, pLpos:-1 no parent} androidx.recyclerview.widget.RecyclerView{c3e8a6a VFED..... ........ 0,0-1064,132 #7f0a0167 app:id/recycler_view_item_categories}, adapter:com.modelsviewing.models.adapter.CategoryMiniAdapter@cc96b5b, layout:androidx.recyclerview.widget.LinearLayoutManager@3da9ff8, context:com.modelsviewing.models.ui.activities.MainActivity@fd65690
at androidx.recyclerview.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:5715)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5898)
at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:286)
at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:343)
at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:359)
at androidx.recyclerview.widget.GapWorker.prefetch(GapWorker.java:366)
at androidx.recyclerview.widget.GapWorker.run(GapWorker.java:397)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7814)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
Galaxy Grand Prime Plus (Android 6.0.1)
Fatal Exception: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{be7844e position=0 id=-1, oldPos=-1, pLpos:-1 no parent} androidx.recyclerview.widget.RecyclerView{d95a717 VFED..... .F...... 0,0-530,77 #7f0a0167 app:id/recycler_view_item_categories}, adapter:com.modelsviewing.models.adapter.CategoryMiniAdapter@46b5704, layout:androidx.recyclerview.widget.LinearLayoutManager@74f74ed, context:com.modelsviewing.models.ui.activities.MainActivity@e02e583
at androidx.recyclerview.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:5715)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5898)
at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:286)
at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:343)
at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:359)
at androidx.recyclerview.widget.GapWorker.prefetch(GapWorker.java:366)
at androidx.recyclerview.widget.GapWorker.run(GapWorker.java:397)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7406)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Привет, у меня проблемы с sh в моем приложении. Я получил данные с помощью Firebase crashlytics. Я добавил модель телефона и отчет sh. Я делюсь кодом HomeFragment. Я буду рад, если вы сможете мне помочь. С уважением, король.