В моем приложении есть сообщения о действиях, в сообщении есть кнопка «Мне нравится», «Число звезд» и «Поделиться»Все работает при отладке на тестовое устройство, но не в опубликованной версии.После публикации приложения в магазине Google все переменные в классе post.class не принимаются и не отображаются (все, что использует post.get , например, post.getimage () не получаетзначения из базы данных firebase. с другой стороны, значения, которые хранятся вне поста, получены (например, у меня есть отдельный узел starcount , и я получаю значение childcount, и он работает нормально)Я перепробовал все возможные решения, но ничего не получилось: обновил приложение с ключом релиза SHA (ключ загрузки), затем сгенерировал подписанный apk (aab), все три SHA (ключ отладки, релиза и подписи приложения) сохранены в моемОтпечаток проекта firebase. Я также проверил правила базы данных firebase. Я изменил некоторую переменную в post.class с public на private
Я скачал APK прямо на устройство, и он также не работает. Он отлично работает наТестовое устройство. Спасибо, если кто-то может помочь и большое спасибо заранее.
это яs post.class
// [START post_class]
@IgnoreExtraProperties
public class Post {
private String image;
public String uid;
public String author;
public String title;
public String body;
public String videoLink;
private int starCount = 0;
private int starCount2 = 0;
private Map<String, Boolean> stars = new HashMap<>();
//shares
private String ntDeeplink;
private int ntNumShares = 0 ;
private String postID;
public Post() {
// Default constructor required for calls to DataSnapshot.getValue(Post.class)
}
public Post(String image, String uid, String author, String title, String body, String videoLink) {
this.image = image;
this.uid = uid;
this.author = author;
this.title = title;
this.body = body;
this.videoLink = videoLink;
}
//note 2 constructor here were icrease instead of one , and the above one in connectedto some methods already
public Post(int starCount, Map<String, Boolean> stars, String ntDeeplink, int ntNumShares, String ntPostID) {
this.starCount = starCount;
this.stars = stars;
this.ntDeeplink = ntDeeplink;
this.ntNumShares = ntNumShares;
this.postID = postID;
}
public Post(int starCount2) {
this.starCount2 = starCount2;
}
// [START post_to_map] ....this and bindToPost(if there is a view) replace the method of populateViewHolder
// but only for non Storage Items like Images
@Exclude
public Map<String, Object> toMap() {
HashMap<String, Object> result = new HashMap<>();
result.put("image",image);
result.put("uid", uid);
result.put("author", author);
result.put("title", title);
result.put("body", body);
result.put("videoLink", videoLink);
result.put("starCount", starCount);
result.put("starCount2", starCount2);
result.put("stars", stars);
//numShares also created int the contants
result.put("ntNumShares", ntNumShares);
result.put("ntDeeplink", ntDeeplink);
result.put("postID", postID);
return result;
}
//shares
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public String getVideoLink() {
return videoLink;
}
public void setVideoLink(String videoLink) {
this.videoLink = videoLink;
}
public int getStarCount() {
return starCount;
}
public void setStarCount(int starCount) {
this.starCount = starCount;
}
public int getStarCount2() {
return starCount2;
}
public void setStarCount2(int starCount2) {
this.starCount2 = starCount2;
}
public Map<String, Boolean> getStars() {
return stars;
}
public void setStars(Map<String, Boolean> stars) {
this.stars = stars;
}
public String getNtDeeplink() {
return ntDeeplink;
}
public void setNtDeeplink(String ntDeeplink) {
this.ntDeeplink = ntDeeplink;
}
public int getNtNumShares() {
return ntNumShares;
}
public void setNtNumShares(int ntNumShares) {
this.ntNumShares = ntNumShares;
}
public String getPostID() {
return postID;
}
public void setPostID(String postID) {
this.postID = postID;
}
// [END post_to_map]
} // [END post_class]
и вот, например, как я получаю изображение в упражнении
ValueEventListener postListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
// Get Post object and use the values to update the UI
final Post post = dataSnapshot.getValue(Post.class);
final DatabaseReference postRef = mPostReference;
final DatabaseReference postRefLikes = mPostReferenceLikes;
// [START_EXCLUDE]
//Image
String image = null;
if (post != null) {
image = post.getImage();
}
Picasso.with(HbDetailActivity.this).load(image).placeholder(R.drawable.likes_hl_gr).into(hbDActivityPostImage);