SeTransactionSyncTask:检索帐户java.lang.IllegalStateException时出错:没有当前的点击付款帐户

时间:2018-06-02 00:12:53

标签: android firebase firebase-realtime-database android-recyclerview

我使用Firebase开发了一款Android应用。 并正在制作一个邮政系统。所以使用这些代码,我想点击Firebase RecyclerView中的每个项目。

我将代码更改为制作可点击的项目。

变化如下。

前,

@Override
protected void onStart() {
    super.onStart();

final Query DBquery = FirebaseDatabase.getInstance().getReference().child("post").orderByChild("count");
FirebaseRecyclerAdapter<Post, PostViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<Post, PostViewHolder>(
        Post.class,
        R.layout.post_row,
        PostViewHolder.class,
        DBquery
        mDatabase
) {
    @Override
    protected void populateViewHolder(PostViewHolder viewHolder, Post model, int position) {

        viewHolder.setTitle(model.getTitle());
        viewHolder.setDesc(model.getDesc());
        viewHolder.setImage(getApplicationContext(), model.getImage());
        viewHolder.setDate(model.getDate());
    }
};
mPostList.setAdapter(firebaseRecyclerAdapter);
}

public static class PostViewHolder extends RecyclerView.ViewHolder {

View mView;

public PostViewHolder(View itemView) {
    super(itemView);

    mView = itemView;
}

public void setTitle(String title){
    TextView post_title = mView.findViewById(R.id.post_title);
    post_title.setText(title);
}

public void setDesc(String desc){

    TextView post_desc = mView.findViewById(R.id.post_desc);
    post_desc.setText(desc);
}

public void setImage(Context ctx, String image){
    ImageView post_image = mView.findViewById(R.id.post_image);
    Picasso.get().load(image).into(post_image);
}

public void setDate(String date){

    TextView post_date = mView.findViewById(R.id.post_date);
    post_date.setText(date);
}
}

后,

@Overried

protected void onStart() {
    super.onStart();

    final Query DBquery = FirebaseDatabase.getInstance().getReference().child("post").orderByChild("count");
    FirebaseRecyclerOptions<Post> options = new FirebaseRecyclerOptions.Builder<Post>()
            .setQuery(DBquery, Post.class)
            .build();

    final FirebaseRecyclerAdapter<Post, PostViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<Post, PostViewHolder>(options) {

        @NonNull
        @Override
        public PostViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {

            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.post_row, parent, false);
            return new PostViewHolder(view);
        }

        @Override
        public void onBindViewHolder(@NonNull PostViewHolder holder, int position, Post model) {
            super.onBindViewHolder(holder, position);

            holder.setTitle(model.getTitle());
            holder.setDesc(model.getDesc());
            holder.setImage(getApplication(), model.getImage());
            holder.setDate(model.getDate());

        }
    };
    mPostList.setAdapter(firebaseRecyclerAdapter);
}



public static class PostViewHolder extends RecyclerView.ViewHolder {

    View mView;

    public PostViewHolder(View itemView) {
        super(itemView);
        mView = itemView;
    }

    public void setTitle(String title){
        TextView post_title = mView.findViewById(R.id.post_title);
        post_title.setText(title);
    }

    public void setDesc(String desc){

        TextView post_desc = mView.findViewById(R.id.post_desc);
        post_desc.setText(desc);
    }

    public void setImage(Context ctx, String image){
        ImageView post_image = mView.findViewById(R.id.post_image);
        Picasso.get().load(image).into(post_image);
    }

    public void setDate(String date){

        TextView post_date = mView.findViewById(R.id.post_date);
        post_date.setText(date);
    }
}

但是我收到了这个错误。我实际上对这个问题一无所知。

在下面构建错误

Program type already present: 
android.arch.lifecycle.LiveData$LifecycleBoundObserver
Message{kind=ERROR, text=Program type already present: 
android.arch.lifecycle.LiveData$LifecycleBoundObserver, sources=[Unknown 
source file], tool name=Optional.of(D8)}

下面的LogCat错误
06-01 23:45:06.261 1959-3666/? E/SeTransactionSyncTask: Error retrieving account
java.lang.IllegalStateException: No current tap-and-pay account
    at alty.b(:com.google.android.gms@12685026@12.6.85 (040700-197041431):3)
    at alty.a(:com.google.android.gms@12685026@12.6.85 (040700-197041431):1)
    at amnv.a(:com.google.android.gms@12685026@12.6.85 (040700-197041431):28)
    at com.google.android.gms.tapandpay.gcmtask.TapAndPayGcmTaskChimeraService.b(:com.google.android.gms@12685026@12.6.85 (040700-197041431):1)
    at com.google.android.gms.tapandpay.gcmtask.TapAndPayGcmTaskChimeraService.a(:com.google.android.gms@12685026@12.6.85 (040700-197041431):1)
    at com.google.android.gms.tapandpay.phenotype.PhenotypeCommitIntentOperation.onHandleIntent(:com.google.android.gms@12685026@12.6.85 (040700-197041431):47)
    at com.google.android.chimera.IntentOperation.onHandleIntent(:com.google.android.gms@12685026@12.6.85 (040700-197041431):2)
    at dbn.a(:com.google.android.gms@12685026@12.6.85 (040700-197041431):8)
    at nam.a(:com.google.android.gms@12685026@12.6.85 (040700-197041431):9)
    at dbs.run(:com.google.android.gms@12685026@12.6.85 (040700-197041431):10)
    at dbp.run(:com.google.android.gms@12685026@12.6.85 (040700-197041431):9)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
    at java.lang.Thread.run(Thread.java:761)

1 个答案:

答案 0 :(得分:2)

我面临类似的问题。但是,当我打开logcat并选择选项(在logcat屏幕的右上角)“仅显示所选应用程序”时,未显示错误。对于我来说,错误似乎对应用没有影响,并且无论有无错误,应用都能正常运行。我使用Google Sheets api来读取和写入应用程序中的数据,但是付款不是应用程序的一部分。