发生StorageException。对象在该位置不存在。代码:-13010 HttpResult:android studio logcat中的404

时间:2018-11-04 05:58:40

标签: android firebase android-studio

这是我的logcat:

  

2018-11-04 08:54:03.257 20512-20582 / com.example.nabil.logindemo   E / StorageException:发生StorageException。       对象在该位置不存在。        代码:-13010 HttpResult:404 2018-11-04 08:54:03.268 20512-20582 / com.example.nabil.logindemo E / StorageException:{   “错误”:{“代码”:404,“消息”:“未找到。无法获取   对象”}}       java.io.IOException:{“错误”:{“代码”:404,“消息”:“未找到。无法获取对象”}}           com.google.firebase.storage.network.NetworkRequest.parseResponse(com.google.firebase:firebase-storage @@ 16.0.4:455)           com.google.firebase.storage.network.NetworkRequest.parseErrorResponse(com.google.firebase:firebase-storage @@ 16.0.4:435)           在com.google.firebase.storage.network.NetworkRequest.processResponseStream(com.google.firebase:firebase-storage @@ 16.0.4:426)           com.google.firebase.storage.network.NetworkRequest.performRequest(com.google.firebase:firebase-storage @@ 16.0.4:280)           com.google.firebase.storage.network.NetworkRequest.performRequest(com.google.firebase:firebase-storage @@ 16.0.4:294)           在com.google.firebase.storage.internal.ExponentialBackoffSender.sendWithExponentialBackoff(com.google.firebase:firebase-storage @@ 16.0.4:65)           在com.google.firebase.storage.internal.ExponentialBackoffSender.sendWithExponentialBackoff(com.google.firebase:firebase-storage @@ 16.0.4:57)           com.google.firebase.storage.GetDownloadUrlTask​​.run(com.google.firebase:firebase-storage @@ 16.0.4:71)           在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)           在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:636)           在java.lang.Thread.run(Thread.java:784)2018-11-04 08:54:03.945 20512-20512 / com.example.nabil.logindemo E / AndroidRuntime:   致命异常:主要       流程:com.example.nabil.logindemo,PID:20512       android.content.res.Resources $ NotFoundException:字符串资源ID#0xfffffffd           在android.content.res.Resources.getText(Resources.java:410)           在android.content.res.HwResources.getText(HwResources.java:465)           在android.widget.Toast.makeText(Toast.java:328)           在com.example.nabil.logindemo.ProfileActivity $ 2.onCancelled(ProfileActivity.java:65)           位于com.google.firebase.database.core.ValueEventRegistration.fireCancelEvent(com.google.firebase:firebase-database @@ 16.0.4:80)           com.google.firebase.database.core.view.CancelEvent.fire(com.google.firebase:firebase-database @@ 16.0.4:40)           com.google.firebase.database.core.view.EventRaiser $ 1.run(com.google.firebase:firebase-database @@ 16.0.4:55)           在android.os.Handler.handleCallback(Handler.java:808)           在android.os.Handler.dispatchMessage(Handler.java:101)           在android.os.Looper.loop(Looper.java:166)           在android.app.ActivityThread.main(ActivityThread.java:7425)           在java.lang.reflect.Method.invoke(本机方法)           在com.android.internal.os.Zygote $ MethodAndArgsCaller.run(Zygote.java:245)           在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)   2018-11-04 08:54:03.959 731-2760 /? E / iMonitor:FaultDetect:   DUMPTOOL_PRINTF返回。 2018-11-04 08:54:03.962 731-2760 /? E / iMonitor:   FaultDetect:DUMPTOOL_PRINTF返回。 2018-11-04 08:54:03.966   1248-3184 /? E / ReportTools:这不是beta用户版本2018-11-04   08:54:03.970 731-2760 /? E / iMonitor:FaultDetect:DUMPTOOL_PRINTF   返回。 2018-11-04 08:54:03.970 731-2760 /? E / iMonitor:FaultDetect:   DUMPTOOL_PRINTF返回。 2018-11-04 08:54:03.970 731-2760 /? E / iMonitor:   FaultDetect:DUMPTOOL_PRINTF返回。 2018-11-04 08:54:03.970   731-2760 /? E / iMonitor:FaultDetect:DUMPTOOL_PRINTF返回。 2018-11-04   08:54:04.057 1859-1884 /? E / HsmCoreServiceImpl:代码中的onTransact为:   103

这是我的Java代码。

ProfileActivity.Java:

public class ProfileActivity extends AppCompatActivity {
private TextView profilename,emailid,age;
private ImageView imageprofile;
private Button btnedit;
private FirebaseAuth firebaseAuth;
private FirebaseDatabase firebaseDatabase;
private FirebaseStorage firebaseStorage;
private StorageReference storageReference;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_profile);
    profilename=findViewById(R.id.profilename);
    emailid=findViewById(R.id.emailid);
    age=findViewById(R.id.age);
    imageprofile=findViewById(R.id.imageprofile);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    firebaseAuth=FirebaseAuth.getInstance();
    firebaseDatabase=FirebaseDatabase.getInstance();
    firebaseStorage=FirebaseStorage.getInstance();
    storageReference=firebaseStorage.getReference();
    storageReference.child(firebaseAuth.getUid()).child("Images/Profile Pic").getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
        @Override
        public void onSuccess(Uri uri) {
            Picasso.get().load(uri).into(imageprofile);
        }
    });
    DatabaseReference databaseReference=firebaseDatabase.getReference(firebaseAuth.getUid());
    databaseReference.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
            DatabaseValues databaseValues=dataSnapshot.getValue(DatabaseValues.class);
            profilename.setText("Name: "+ databaseValues.getProfile_name());
            emailid.setText("Email: "+ databaseValues.getProfile_username());
            age.setText("Age: "+ databaseValues.getProfile_age());
        }

        @Override
        public void onCancelled(@NonNull DatabaseError databaseError) {
            Toast.makeText(ProfileActivity.this,databaseError.getCode(),Toast.LENGTH_SHORT).show();
        }
    });
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()){
        case android.R.id.home:
            onBackPressed();
    }
    return super.onOptionsItemSelected(item);
}
}

DatabaseValues.Java:

public class DatabaseValues {
private String profile_name;
private String profile_username;
private String profile_age;

public DatabaseValues(){

}

public DatabaseValues(String profile_name, String profile_username, String profile_age) {
    this.profile_name = profile_name;
    this.profile_username = profile_username;
    this.profile_age = profile_age;
}

public String getProfile_name() {
    return profile_name;
}

public void setProfile_name(String profile_name) {
    this.profile_name = profile_name;
}

public String getProfile_username() {
    return profile_username;
}

public void setProfile_username(String profile_username) {
    this.profile_username = profile_username;
}

public String getProfile_age() {
    return profile_age;
}

public void setProfile_age(String profile_age) {
    this.profile_age = profile_age;
}
}

1 个答案:

答案 0 :(得分:0)

该错误表示您对Firebase存储中文件的引用设置不正确。

选中此行,该图像14END OF b1 26 的路径在您的存储中不存在。

您需要编辑参考才能使其正常工作

/Profile Pic