Closed unengchen closed 2 years ago
Thanks for reporting! However, based on the tombstone you have shared I can't pinpoint the issue with ObjectBox (the tombstone does not contain libobjectbox-jni.so
).
As you wrote "when I debug this code" does that mean, when stepping through the code? Or when running the debug version?
Does the crash also happen with ObjectBox 3.2.0
? There were some internal changes for 3.2.1
that might cause issues on 32-bit ARM chips like yours.
I mean when stepping through the code with objectbox version 3.2.0 and 3.2.1。 long assignedId = collect313311(cursor, entity.id, PUT_FLAG_COMPLETE, id8, checkout_date_time, 0, null, 0, null, 0, null, ID_type, entity.type, __ID_operate_type, entity.operate_type, ID_uploaded, entity.uploaded ? 1 : 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); my app crash,and I do not catch any expection, so I copy the logcat info when app crash,but I am sure that the issues happen in objectbox. because cancel running about the objectbox code,app is normal,the issues has no happen.
and find data from objectbox is normal, just put data and remove data is crash,and then, I use boxstore delete all files,put data and remove data is normal,
my entity class
@Entity
public class Log {
@Id
public long id;
public int type;
public String date_time;
public String content;
public String operator;
public int operate_type; // 1-入库,2-出库
public String log_detail;
public boolean uploaded = false;
// 出库打卡时间,为了合并到入库记录,导出日志
public String checkout_date_time;
public Log(){
}
public Log(int type, String date_time, String content,String operator) {
this();
this.type = type;
this.date_time = date_time;
this.content = content;
this.operator = operator;
this.checkout_date_time = "";
}
}
Tried to reproduce on
As said before, given that the tombstone does not seem to include libobjectbox-jni.so
I'm not sure if this is an ObjectBox issue.
@unengchen Can you show the code that puts the object? Or maybe even share a small example project that reproduces this issue?
that is the code:
GlobalScope.launch(Dispatchers.IO) {
try {
val dateTime = TimeUtils.millis2String(DateTimeManager.timestamp)
val log = Log(logType, dateTime, logContent, operator.name)
log.operate_type = operateType
val persons = arrayListOf<Person>()
persons.add(operator)
val personList = gson.toJson(persons)
log.uploaded = SocketSendHelper.uploadLog(log, personList)
val takeImage = operator.image
if (!StringUtils.isTrimEmpty(takeImage)) {
val imageBytes = Base64.decode(takeImage, Base64.DEFAULT)
val bitmap = ImageUtils.bytes2Bitmap(imageBytes)
val photoPath =
AppManager.logDir + File.separator + "log_${operator.timestamp}.jpg"
val save =
ImageUtils.save(bitmap, photoPath, Bitmap.CompressFormat.JPEG, 60, true)
if (save) {
// 保存图片成功
operator.takeImagePath = photoPath
}
LogUtils.d("保存日志图片路径", photoPath)
}
persons.clear()
val person = Person(operator.code, operator.name, operator.role)
person.image = ""
person.takeImagePath = operator.takeImagePath
person.authTime = operator.authTime
person.type = operator.type
persons.add(person)
log.log_detail = gson.toJson(persons)
ObjectBoxManager.getLogBox().put(log)
if (logType == LOG_TYPE_CHECK_IN_OUT && operateType == OPERATE_TYPE_OUT) {
// 入库打卡记录增加出库时间
val checkInLog = getCheckInLog(operator.name) ?: return@launch
checkInLog.checkout_date_time = dateTime
ObjectBoxManager.getLogBox().put(checkInLog)
}
} catch (e: Exception) {
ToastUtils.showLong("保存日志$logType:${e.message}")
}
}
Sorry, not seeing any obvious issue. Can also debug when doing put
inside a coroutine.
If you want us to continue looking into this, please share a small example project that reproduces this issue.
Without additional information, we are unfortunately not sure how to resolve this issue. Therefore this issue has been automatically closed. Feel free to comment with additional details and we can re-open this issue.
Describe the bug A clear and concise description in English of what the bug is.
Basic info (please complete the following information):
To Reproduce Steps to reproduce the behavior: just use box.put(bean)
Expected behavior app crash and do not catch any excption.
Code
Logs, stack traces
Additional context Add any other context about the problem here. when I debug this code, my app crash。