将我的应用程序发布到 google playstore 后,我的应用程序无法获取 firestore 数据以回收分页视图

Posted

技术标签:

【中文标题】将我的应用程序发布到 google playstore 后,我的应用程序无法获取 firestore 数据以回收分页视图【英文标题】:After Publishing my apps to google playstore, my Apps cannot fetch firestore data to recycle pagination view 【发布时间】:2021-06-29 10:12:18 【问题描述】:

在发布到 Play 商店之前测试我的应用程序时。我的应用能够从 firestore 获取数据以回收视图。

在第二张图片中,在上传文件之前,应用程序可以从 Firestore 读取数据,但无法将其提取到回收视图中 这是问题的代码:

package com.hmatewu.ewulife;

import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.paging.PagedList;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;``


import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;

import android.widget.TextView;
import android.widget.Toast;




import com.firebase.ui.firestore.paging.FirestorePagingAdapter;
import com.firebase.ui.firestore.paging.FirestorePagingOptions;
import com.firebase.ui.firestore.paging.LoadingState;


import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.Query;

import java.util.ArrayList;
import java.util.List;




public class FeedFragment extends Fragment 

    public FirebaseFirestore fstore;



   public RecyclerView recyclerView;
   public ArrayList<String> arrayList_parent;
   public ArrayAdapter<String> arrayAdapter_parent;

    public static final String EXTRA_NFID= "com.hm.roktojoddha.EXTRA_NFID";
    public static final String EXTRA_MOBILE= "com.hm.roktojoddha.EXTRA_MOBILE";
    public static final String EXTRA_ID= "com.hm.roktojoddha.EXTRA_ID";

    List<String> cgpa_list = new ArrayList<>();
    public Query query;

    FirestorePagingAdapter adapter;
    public FeedFragment() 
        // Required empty public constructor
    




    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) 
        // Inflate the layout for this fragment
        View v = inflater.inflate(R.layout.fragment_feed, container, false);
        


        fstore=FirebaseFirestore.getInstance();


        recyclerView= v.findViewById(R.id.rev_view);

        arrayList_parent = new ArrayList<>();


        query = fstore.collection("News_Feed");
        PagedList.Config config = new PagedList.Config.Builder()
                .setInitialLoadSizeHint(5).setPageSize(3).build();

        FirestorePagingOptions< newsadapter > options = new FirestorePagingOptions.Builder<newsadapter>()
                .setLifecycleOwner(getActivity())
                .setQuery(query, config,newsadapter.class).build();


        adapter = new FirestorePagingAdapter<newsadapter, ProductViewHolder>(options) 
            @NonNull
            @Override
            public ProductViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) 
                View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.news_recycle, parent, false);
                return new ProductViewHolder(view);
            

            @Override
            public void onBindViewHolder(@NonNull ProductViewHolder holder, int positions, @NonNull final newsadapter newsadapter) 

                holder.a1.setText(newsadapter.getTitle());
                holder.a2.setText(newsadapter.getDescription());
                holder.b1.setOnClickListener(new View.OnClickListener() 
                    @Override
                    public void onClick(View v) 
                        String n_fid= newsadapter.getNFID();
                        String category = newsadapter.getCategory();
                        String mobile = newsadapter.getMobile();
                        String id = newsadapter.getUpload_User_ID();

                    if(category.equals("Blood"))
                        Intent intent = new Intent(getActivity(), BloodInfoActivity.class);
                        intent.putExtra(EXTRA_NFID, n_fid);
                        intent.putExtra(EXTRA_MOBILE, mobile);
                        intent.putExtra(EXTRA_ID, id);
                        startActivity(intent);
                    
                        if(category.equals("Add"))
                            Intent intent = new Intent(getActivity(), AddDropActivity.class);
                            startActivity(intent);
                        
                        if(category.equals("Calender"))
                            Intent intent = new Intent(getActivity(), CalenderActivity.class);
                            startActivity(intent);
                        
                        if(category.equals("Advising"))
                            Intent intent = new Intent(getActivity(), AdvisingActivity.class);
                            startActivity(intent);
                        
                        if(category.equals("Course"))
                            Intent intent = new Intent(getActivity(), Course_ChartActivity.class);
                            startActivity(intent);
                        
                        if(category.equals("Club"))

                            Intent intent = new Intent(getActivity(), ClubInfoActivity.class);
                            intent.putExtra(EXTRA_NFID, n_fid);
                            intent.putExtra(EXTRA_ID, id);
                            startActivity(intent);

                        
                        if(category.equals("Others"))
                            Toast.makeText(getActivity(), "Just a Notice", Toast.LENGTH_SHORT).show();
                        

                    
                );





            

            @Override
            public void onLoadingStateChanged(@NonNull LoadingState state) 
                super.onLoadingStateChanged(state);
                switch (state)
                    case LOADING_INITIAL:Toast.makeText(getActivity(), "Loading Initial Data", Toast.LENGTH_SHORT).show();
                    break;
                    case LOADING_MORE:Toast.makeText(getActivity(), "Loading Next Page", Toast.LENGTH_SHORT).show();
                    break;

                    case FINISHED: Toast.makeText(getActivity(), "Finished", Toast.LENGTH_SHORT).show();
                    break;
                    case ERROR:   Toast.makeText(getActivity(), "ERROR", Toast.LENGTH_SHORT).show();
                    break;

                    case LOADED:  Toast.makeText(getActivity(), "Loaded", Toast.LENGTH_SHORT).show();
                    break;

                
            
        ;




        recyclerView.setHasFixedSize(true);
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        recyclerView.setAdapter(adapter);

        return v;
    




    public class ProductViewHolder extends RecyclerView.ViewHolder 
        TextView a1,a2;
        Button b1;

        public ProductViewHolder(@NonNull View itemView) 
            super(itemView);
            a1 = itemView.findViewById(R.id.textView67);
            a2 = itemView.findViewById(R.id.textView68);
            b1 = itemView.findViewById(R.id.button9);


        
    
   // @Override
   // public void onStart() 
     //   super.onStart();

     //   adapter.startListening();

   // 

   // @Override
   // public void onStop() 
    //    super.onStop();
   //     adapter.stopListening();

    //

所以这是我用于该活动文件的代码,但在其他 2 个活动中也出现了同样的问题。 所以无法抓住问题 这也是我在 Playstore 中的应用的链接

这里是 LogCat:

2021-04-06 10:13:46.403 919-919/? E/OIFACE_HAL: open /proc/shell-temp failed(No such file or directory)
2021-04-06 10:13:46.705 1729-2816/? E/InputReader: isBtnTouch is true need to clear slots
2021-04-06 10:13:46.725 1289-1425/? E/statsd: Found dropped events: 1 error -19 last atom tag 83 from uid 10387
2021-04-06 10:13:47.286 32325-32325/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.hmatewu.ewulife, PID: 32325
    java.lang.RuntimeException: No properties to serialize found on class e.f.a.o1
        at e.e.d.x.o0.k$a.<init>(:21)
        at e.e.d.x.o0.k.g(Unknown Source:12)
        at e.e.d.x.o0.k.c(:18)
        at e.e.d.x.h.f(:2)
        at e.e.d.x.z.f(Unknown Source:5)
        at e.e.d.x.z.e(:1)
        at e.d.a.d.b.a(:1)
        at com.firebase.ui.firestore.paging.FirestorePagingAdapter.o(Unknown Source:8)
        at androidx.recyclerview.widget.RecyclerView$e.p(Unknown Source:0)
        at androidx.recyclerview.widget.RecyclerView$s.j(:83)
        at androidx.recyclerview.widget.LinearLayoutManager$c.c(:3)
        at androidx.recyclerview.widget.LinearLayoutManager.v1(Unknown Source:0)
        at androidx.recyclerview.widget.LinearLayoutManager.g1(:2)
        at androidx.recyclerview.widget.LinearLayoutManager.u0(:20)
        at androidx.recyclerview.widget.RecyclerView.s(Unknown Source:38)
        at androidx.recyclerview.widget.RecyclerView.q(:7)
        at androidx.recyclerview.widget.RecyclerView.n(:9)
        at androidx.recyclerview.widget.RecyclerView$a.run(Unknown Source:31)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1103)
        at android.view.Choreographer.doCallbacks(Choreographer.java:926)
        at android.view.Choreographer.doFrame(Choreographer.java:848)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1088)
        at android.os.Handler.handleCallback(Handler.java:899)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:238)
        at android.app.ActivityThread.main(ActivityThread.java:7864)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:998)
2021-04-06 10:13:47.301 4120-4149/? E/hypnusd: set new thermal delta to 0 (prev = 0) right now
2021-04-06 10:13:47.400 919-919/? E/OIFACE_HAL: open /proc/shell-temp failed(No such file or directory)
2021-04-06 10:13:47.419 1729-2815/? E/InputDispatcher: channel 'e15cc28 Toast (server)' ~ Channel is unrecoverably broken and will be disposed!
2021-04-06 10:13:47.448 1729-2815/? E/InputDispatcher: channel 'ce47dbe com.hmatewu.ewulife/com.hmatewu.ewulife.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2021-04-06 10:13:47.510 1729-3920/? E/OppoThermalStats: Error getting package info: com.oppo.launcher
2021-04-06 10:13:47.586 1729-28064/? E/ANDR-PERF-JNI: UXEngine Trigger - Returning null
2021-04-06 10:13:47.597 31903-32022/? E/msgr.MsysPublishManager: onPublishError, token=10
    java.net.SocketTimeoutException: MQTT connection timeout
        at X.2BI.run(Unknown Source:125)
        at X.0pV.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at X.0pb.run(Unknown Source:3)
        at X.0pc.run(Unknown Source:12)
        at java.lang.Thread.run(Thread.java:919)
2021-04-06 10:13:47.599 31903-32111/? E/msgr.msys: E[N rtchannel]_rt_mqtt_publish_callback(356)=>Failed to publish the request over MQTT. token:724b9903-a7c2-4d25-acae-8b450abab0ba, category:mcd-sync-data-task-category, requestId:28607, error:Error Domain=mqtt Code=3008
2021-04-06 10:13:47.600 31903-32110/? E/msgr.msys: E[S sync]_createResponseError(166)=>Network Response 724b9903-a7c2-4d25-acae-8b450abab0ba contains sync error Error Domain=mqtt Code=3008 - Underlying error (null): Error Domain=mqtt Code=3008
2021-04-06 10:13:47.819 1729-4535/? E/Process: get_ion_cache_memory: Unable to open /d/ion/system_stats
2021-04-06 10:13:47.821 1729-4535/? E/Process: get_ion_cache_memory: Unable to open /d/ion/system_stats
2021-04-06 10:13:47.832 4128-25391/? E/oiface: packageSwitch pkg com.oppo.launcher, enter
2021-04-06 10:13:47.832 4128-25391/? E/oiface: current package is com.oppo.launcher
2021-04-06 10:13:47.841 4128-4143/? E/oiface: access /sys/devices/system/cpu/cpu6/cpufreq/stats/time_in_state failed(No such file or directory)
2021-04-06 10:13:47.841 4128-4143/? E/oiface: Average freq 0 for 0s.
2021-04-06 10:13:47.841 4128-4143/? E/oiface: access /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state failed(No such file or directory)
2021-04-06 10:13:47.841 4128-4143/? E/oiface: Average freq 0 for 0s.
2021-04-06 10:13:47.851 4128-4143/? E/oiface: client  not found, skipped
2021-04-06 10:13:47.859 4128-4143/? E/oiface: access /sys/devices/system/cpu/cpu6/cpufreq/stats/time_in_state failed(No such file or directory)
2021-04-06 10:13:47.859 4128-4143/? E/oiface: access /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state failed(No such file or directory)
2021-04-06 10:13:47.879 1729-5766/? E/Process: get_ion_cache_memory: Unable to open /d/ion/system_stats
2021-04-06 10:13:47.944 1729-5766/? E/OppoKillerManagerService: o-kill [32604] com.android.vending:download_service
2021-04-06 10:13:47.945 1729-5766/? E/OppoKillerManagerService: o-kill [32453] com.android.vending
2021-04-06 10:13:47.946 1729-5766/? E/Process: get_ion_cache_memory: Unable to open /d/ion/system_stats
2021-04-06 10:13:47.947 1729-5766/? E/OppoKillerManagerService: o-kill [32421] com.qualcomm.qti.modemtestmode
2021-04-06 10:13:47.949 1729-4535/? E/Process: get_ion_cache_memory: Unable to open /d/ion/system_stats
2021-04-06 10:13:47.949 1729-4535/? E/Process: get_ion_cache_memory: Unable to open /d/ion/system_stats
2021-04-06 10:13:48.058 1729-5766/? E/Process: get_ion_cache_memory: Unable to open /d/ion/system_stats
2021-04-06 10:13:48.061 1729-3920/? E/Process: get_ion_cache_memory: Unable to open /d/ion/system_stats
2021-04-06 10:13:48.402 919-919/? E/OIFACE_HAL: open /proc/shell-temp failed(No such file or directory)

Before uploading to firebase

Before and after uploading apps in firebase

https://play.google.com/store/apps/details?id=com.hmatewu.ewulife

fire base sh1

play console app intrigrity

key from the studio

【问题讨论】:

ibb.co/…这是从playstore上传安装后的图片 您通过Launch Checklist 工作了吗?默认情况下,FirestoreRecyclerAdapter 会记录其查询的任何错误,因此请查看您应用的日志以获取更多信息。 ibb.co/QQdTp5t ibb.co/5kxXbkB 你在说这个吗? 您是否尝试记录错误?也许出了点问题而你不知道。 它崩溃了 【参考方案1】:

这是 pro gruad 中的错误....来自 google 的收缩功能... 禁用它

我没有在网上找到它.....自己排序。

 //minifyEnabled true
            //shrinkResources true

            //proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

【讨论】:

【参考方案2】:

这是因为 progaurds minify 在您编译程序时会更改类的名称。

您可以更改构建 gradle 以使 minifyEnabled 为 false,或者您可以在您使用的模型类之前使用 @Keep 来保留它们的 Firestore 命名约定。

release 
        debuggable true
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),    'proguard-rules.pro'
    

@Keep
newsadapter()

【讨论】:

以上是关于将我的应用程序发布到 google playstore 后,我的应用程序无法获取 firestore 数据以回收分页视图的主要内容,如果未能解决你的问题,请参考以下文章

我应该将我的 Nuxt 应用程序直接部署到 Google App Engine 还是应该在我的代码存在于存储库中的地方使用 Gitlab CI/CD?

将我的 Google 图表(表格)数据导出到 excel 或 csv

我如何将我的Python代码链接到Google Cloud的服务?我应该使用哪种服务?

我想将我的应用程序目标sdk版本29降级到28,google play控制台可以允许吗?

带有 Auto Scaling 的 Google Compute Engine 负载平衡。它会将我的网站复制到新实例吗?

Google Play 应用签名的工作原理