我收到此异常:对象在该位置不存在
I am getting this exception: Object does not exist at location
E/StorageException: StorageException has occurred.
Object does not exist at location.
Code: -13010 HttpResult: 404
2021-09-13 00:52:49.705 20328-20869/com.dishanamdev.advibe E/StorageException: { "error": { "code": 404, "message": "Not Found. Could not get object", "status": "GET_OBJECT" }}
java.io.IOException: { "error": { "code": 404, "message": "Not Found. Could not get object", "status": "GET_OBJECT" }}
我在 firebase 存储中的安全规则是
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
我的 java 代码。在这里,我无法理解b
写什么和firebase storage rules
写bucket
写什么。
你能告诉我,与我的 java 代码相比,在上述两个地方写什么吗?
我试着用 user
代替 b
,用 currentID
代替 bucket
,但没有用。
这样:
rules_version = '2';
service firebase.storage {
match /user/{currentID}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
public void onStart() {
super.onStart();
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
String currentId = user.getUid();
DocumentReference reference;
FirebaseFirestore firestore = FirebaseFirestore.getInstance();
reference = firestore.collection("user").document(currentId);
reference.get()
.addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if(task.getResult().exists()){
String nameResult = task.getResult().getString("name");
String bioResult = task.getResult().getString("bio");
nameET.setText(nameResult);
bioET.setText(bioResult);
}else{
Intent intent = new Intent(getActivity(),CreateProfile.class);
startActivity(intent);
}
}
});}
请帮助我。
现在,我解决了这个问题。当我们没有在 firebase.So 中上传包含所有数据(包括照片、文本等)的对象时,如果其他人在 class 中遇到相同的问题 then must check your code again
,则会出现此错误=] 的 java 个文件,您在其中创建了 firebase 存储参考、数据库参考、文档参考
E/StorageException: StorageException has occurred.
Object does not exist at location.
Code: -13010 HttpResult: 404
2021-09-13 00:52:49.705 20328-20869/com.dishanamdev.advibe E/StorageException: { "error": { "code": 404, "message": "Not Found. Could not get object", "status": "GET_OBJECT" }}
java.io.IOException: { "error": { "code": 404, "message": "Not Found. Could not get object", "status": "GET_OBJECT" }}
我在 firebase 存储中的安全规则是
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
我的 java 代码。在这里,我无法理解b
写什么和firebase storage rules
写bucket
写什么。
你能告诉我,与我的 java 代码相比,在上述两个地方写什么吗?
我试着用 user
代替 b
,用 currentID
代替 bucket
,但没有用。
这样:
rules_version = '2';
service firebase.storage {
match /user/{currentID}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
public void onStart() {
super.onStart();
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
String currentId = user.getUid();
DocumentReference reference;
FirebaseFirestore firestore = FirebaseFirestore.getInstance();
reference = firestore.collection("user").document(currentId);
reference.get()
.addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if(task.getResult().exists()){
String nameResult = task.getResult().getString("name");
String bioResult = task.getResult().getString("bio");
nameET.setText(nameResult);
bioET.setText(bioResult);
}else{
Intent intent = new Intent(getActivity(),CreateProfile.class);
startActivity(intent);
}
}
});}
请帮助我。
现在,我解决了这个问题。当我们没有在 firebase.So 中上传包含所有数据(包括照片、文本等)的对象时,如果其他人在 class 中遇到相同的问题 then must check your code again
,则会出现此错误=] 的 java 个文件,您在其中创建了 firebase 存储参考、数据库参考、文档参考