2016-09-21 95 views
1

我試圖編輯我的存儲規則,檢索圖片進入RecyclerView:無法創建火力地堡存儲網絡請求android.os.RemoteException同時使用火力地堡

service firebase.storage { 
    match /b/askdoctor-546bf.appspot.com/o { 
    match /{allPaths=**} { 
     allow read, write; 
    } 
    } 
} 

但我仍面臨以下這個錯誤。我已閱讀有關此現有類似的帖子,但我仍然得到這個錯誤。我究竟做錯了什麼?

09-21 12:56:07.424 2296-2296/oerrride.we.huzykamz.testingappfirebase E/FirebaseCrash: Failed to initialize crash reporting 
                         com.google.firebase.crash.internal.zzg$zza: com.google.android.gms.internal.zzsb$zza: No acceptable module found. Local version is 0 and remote version is 0. 
                          at com.google.firebase.crash.internal.zzg.zzbq(Unknown Source) 
                          at com.google.firebase.crash.FirebaseCrash.<init>(Unknown Source) 
                          at com.google.firebase.crash.FirebaseCrash.getInstance(Unknown Source) 
                          at java.lang.reflect.Method.invoke(Native Method) 
                          at com.google.firebase.FirebaseApp.zza(Unknown Source) 
                          at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
                          at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
                          at com.google.firebase.FirebaseApp.zzek(Unknown Source) 
                          at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
                          at android.content.ContentProvider.attachInfo(ContentProvider.java:1748) 
                          at android.content.ContentProvider.attachInfo(ContentProvider.java:1723) 
                          at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
                          at android.app.ActivityThread.installProvider(ActivityThread.java:5153) 
                          at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748) 
                          at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688) 
                          at android.app.ActivityThread.-wrap1(ActivityThread.java) 
                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405) 
                          at android.os.Handler.dispatchMessage(Handler.java:102) 
                          at android.os.Looper.loop(Looper.java:148) 
                          at android.app.ActivityThread.main(ActivityThread.java:5417) 
                          at java.lang.reflect.Method.invoke(Native Method) 
                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                         Caused by: com.google.android.gms.internal.zzsb$zza: No acceptable module found. Local version is 0 and remote version is 0. 
                          at com.google.android.gms.internal.zzsb.zza(Unknown Source) 
                          at com.google.firebase.crash.internal.zzg.zzbq(Unknown Source)  
                          at com.google.firebase.crash.FirebaseCrash.<init>(Unknown Source)  
                          at com.google.firebase.crash.FirebaseCrash.getInstance(Unknown Source)  
                          at java.lang.reflect.Method.invoke(Native Method)  
                          at com.google.firebase.FirebaseApp.zza(Unknown Source)  
                          at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)  
                          at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)  
                          at com.google.firebase.FirebaseApp.zzek(Unknown Source)  
                          at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)  
                          at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)  
                          at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)  
                          at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)  
                          at android.app.ActivityThread.installProvider(ActivityThread.java:5153)  
                          at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)  
                          at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)  
                          at android.app.ActivityThread.-wrap1(ActivityThread.java)  
                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)  
                          at android.os.Handler.dispatchMessage(Handler.java:102)  
                          at android.os.Looper.loop(Looper.java:148)  
                          at android.app.ActivityThread.main(ActivityThread.java:5417)  
                          at java.lang.reflect.Method.invoke(Native Method)  
                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  
                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)  
09-21 12:56:09.873 2296-2296/oerrride.we.huzykamz.testingappfirebase E/RecyclerView: No adapter attached; skipping layout 
09-21 12:56:09.942 2296-2296/oerrride.we.huzykamz.testingappfirebase E/RecyclerView: No adapter attached; skipping layout 
09-21 12:56:15.585 2296-2456/oerrride.we.huzykamz.testingappfirebase E/NetworkRqFactoryProxy: NetworkRequestFactoryProxy failed with a RemoteException: 
                           com.google.android.gms.internal.zzsb$zza: No acceptable module found. Local version is 0 and remote version is 0. 
                            at com.google.android.gms.internal.zzsb.zza(Unknown Source) 
                            at com.google.android.gms.internal.zzami.<init>(Unknown Source) 
                            at com.google.android.gms.internal.zzami.zzi(Unknown Source) 
                            at com.google.firebase.storage.StorageReference.zzcxz(Unknown Source) 
                            at com.google.firebase.storage.zzb.run(Unknown Source) 
                            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
                            at java.lang.Thread.run(Thread.java:818) 
09-21 12:56:15.585 2296-2456/oerrride.we.huzykamz.testingappfirebase E/GetMetadataTask: Unable to create firebase storage network request. 
                         android.os.RemoteException 
                          at com.google.android.gms.internal.zzami.<init>(Unknown Source) 
                          at com.google.android.gms.internal.zzami.zzi(Unknown Source) 
                          at com.google.firebase.storage.StorageReference.zzcxz(Unknown Source) 
                          at com.google.firebase.storage.zzb.run(Unknown Source) 
                          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
                          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
                          at java.lang.Thread.run(Thread.java:818) 
09-21 12:56:15.586 2296-2456/oerrride.we.huzykamz.testingappfirebase E/StorageException: StorageException has occurred. 
                         An unknown error occurred, please check the HTTP result code and inner exception for server response. 
                          Code: -13000 HttpResult: 0 
09-21 12:56:15.586 2296-2456/oerrride.we.huzykamz.testingappfirebase E/StorageException: null 
                         android.os.RemoteException 
                          at com.google.android.gms.internal.zzami.<init>(Unknown Source) 
                          at com.google.android.gms.internal.zzami.zzi(Unknown Source) 
                          at com.google.firebase.storage.StorageReference.zzcxz(Unknown Source) 
                          at com.google.firebase.storage.zzb.run(Unknown Source) 
                          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
                          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
                          at java.lang.Thread.run(Thread.java:818) 
09-21 12:56:15.615 2296-2457/oerrride.we.huzykamz.testingappfirebase E/NetworkRqFactoryProxy: NetworkRequestFactoryProxy failed with a RemoteException: 
                           com.google.android.gms.internal.zzsb$zza: No acceptable module found. Local version is 0 and remote version is 0. 
                            at com.google.android.gms.internal.zzsb.zza(Unknown Source) 
                            at com.google.android.gms.internal.zzami.<init>(Unknown Source) 
                            at com.google.android.gms.internal.zzami.zzi(Unknown Source) 
                            at com.google.firebase.storage.StorageReference.zzcxz(Unknown Source) 
                            at com.google.firebase.storage.zzb.run(Unknown Source) 
                            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
                            at java.lang.Thread.run(Thread.java:818) 
09-21 12:56:15.615 2296-2457/oerrride.we.huzykamz.testingappfirebase E/GetMetadataTask: Unable to create firebase storage network request. 
                         android.os.RemoteException 
                          at com.google.android.gms.internal.zzami.<init>(Unknown Source) 
                          at com.google.android.gms.internal.zzami.zzi(Unknown Source) 
                          at com.google.firebase.storage.StorageReference.zzcxz(Unknown Source) 
                          at com.google.firebase.storage.zzb.run(Unknown Source) 
                          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
                          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
                          at java.lang.Thread.run(Thread.java:818) 
09-21 12:56:15.616 2296-2457/oerrride.we.huzykamz.testingappfirebase E/StorageException: StorageException has occurred. 
                         An unknown error occurred, please check the HTTP result code and inner exception for server response. 
                          Code: -13000 HttpResult: 0 
09-21 12:56:15.616 2296-2457/oerrride.we.huzykamz.testingappfirebase E/StorageException: null 
                         android.os.RemoteException 
                          at com.google.android.gms.internal.zzami.<init>(Unknown Source) 
                          at com.google.android.gms.internal.zzami.zzi(Unknown Source) 
                          at com.google.firebase.storage.StorageReference.zzcxz(Unknown Source) 
                          at com.google.firebase.storage.zzb.run(Unknown Source) 
                          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
                          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
                          at java.lang.Thread.run(Thread.java:818) 

下面是我的Adapter類,它嘗試在使用畢加索時將圖像顯示在imageView中。

package oerrride.we.huzykamz.testingappfirebase; 

import android.content.Context; 
import android.net.Uri; 
import android.support.v7.widget.RecyclerView; 
import android.view.LayoutInflater; 
import android.view.View; 
import android.view.ViewGroup; 

import com.google.android.gms.tasks.OnSuccessListener; 
import com.google.firebase.storage.FirebaseStorage; 
import com.google.firebase.storage.StorageReference; 
import com.squareup.picasso.Picasso; 

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


public class MyAdapter extends RecyclerView.Adapter<MyViewHolder> { 


    protected Context c; 
    List<ModelClass> doctors; 

    public FirebaseStorage mStorage= FirebaseStorage.getInstance(); 

    StorageReference storageRef = mStorage.getReferenceFromUrl("gs://askdoctor-546bf.appspot.com"); 




    public MyAdapter(Context c, List<ModelClass> doctors) { 
     this.c = c; 
     this.doctors = doctors; 
    } 

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

     View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_activity,parent,false); 
     MyViewHolder holder = new MyViewHolder(v); 
     return holder; 
    } 

    @Override 
    public void onBindViewHolder(final MyViewHolder holder, int position) { 
     final ModelClass feedItems = doctors.get(position); 



     storageRef.child("askdoctor").getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() { 
      @Override 
      public void onSuccess(Uri uri) { 

       System.out.println("Here is the print of url : "+uri.toString()); 
       Picasso.with(c).load(uri.toString()+feedItems.getPhoto()) 
         .error(R.mipmap.ic_launcher). 
         resize(50, 50) 
         .placeholder(R.mipmap.ic_launcher).into(holder.img); 
      } 
     }); 

    /* StorageReference spaceRef = mStorage.getReferenceFromUrl("gs://askdoctor-546bf.appspot.com/askdoctor/"+feedItems.getPhoto()); 
     String url = spaceRef.getPath(); 



     System.out.println("Here is the print of url : "+url); 

       Picasso.with(c).load("gs://askdoctor-546bf.appspot.com"+url) 
         .error(R.mipmap.ic_launcher). 
         resize(50, 50) 
         .placeholder(R.mipmap.ic_launcher).into(holder.img); 
*/ 

     holder.name.setText(doctors.get(position).getDoctorsName()); 
     holder.email_txt.setText(doctors.get(position).getEmail()); 
     // PicassoClient.downloadImage(c,doctors.get(position).getUrl(),holder.img); 
     //Download image using picasso library 





    } 

    @Override 
    public int getItemCount() { 
     return doctors.size(); 
    } 
} 
+0

有你檢查你的播放服務的版本......應當最新的模擬器或設備在其上運行的代碼 –

+0

是的,我的播放服務是最新的,你的意思是我使用最新的播放服務版本的模擬器?請我仍然是新的 –

+0

檢查它在真正的設備.....可能是你的設備沒有它... –

回答

0

,你需要正確的路徑和圖像擴展添加到子

storageRef.child("askdoctor/"+feedItems.getPhoto()+".png").getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() { 
      @Override 
      public void onSuccess(Uri uri) { 

       System.out.println("Here is the print of url : "+uri.toString()); 
       Picasso.with(c).load(uri.toString()) 
         .error(R.mipmap.ic_launcher). 
         resize(50, 50) 
         .placeholder(R.mipmap.ic_launcher).into(holder.img); 
      } 
     });