chore: bump version to 23.01.34, logcat capture improvements, and fix JS cached bundle

This commit is contained in:
Jannik committed 2026-08-19 18:16:23 +02:00
1 parent 635c1e8be4
commit d2770fb4e2
9 files changed
+106 -53

No files matched your search

@@ -14,17 +14,28 @@ class UsbCameraModule : Module() {
AsyncFunction("getLogcat") { promise: Promise ->
try {
val process = Runtime.getRuntime().exec("logcat -d -v time -s UsbCameraView CameraClient")
val pid = android.os.Process.myPid()
val process = Runtime.getRuntime().exec("logcat -d -v time --pid=$pid -t 800")
val bufferedReader = BufferedReader(InputStreamReader(process.inputStream))
val log = java.lang.StringBuilder()
var line: String? = bufferedReader.readLine()
while (line != null) {
var line: String?
while (bufferedReader.readLine().also { line = it } != null) {
log.append(line).append("\n")
line = bufferedReader.readLine()
}
// Also append the custom init crash file if it exists
val context = appContext.reactContext
if (context != null) {
val crashFile = java.io.File(context.filesDir, "init_crash.txt")
if (crashFile.exists()) {
log.append("\n--- INIT CRASH LOG ---\n")
log.append(crashFile.readText())
}
}
promise.resolve(log.toString())
} catch (e: Exception) {
promise.resolve("Error reading logcat: ${e.message}")
promise.resolve("Failed to read logcat: ${e.message}")
}
}
@@ -90,13 +90,22 @@ class UsbCameraView(context: Context, appContext: AppContext) : ExpoView(context
.setCameraRequest(cameraRequest)
.setEnableGLES(false)
.build()
// Start the camera preview asynchronously
post {
startPreview()
}
} catch (e: Throwable) {
android.util.Log.e("UsbCameraView", "CRASH IN INIT: ${e.message}", e)
e.printStackTrace()
val errorMsg = "CRASH IN INIT: ${e.message}\n${android.util.Log.getStackTraceString(e)}"
android.util.Log.e("UsbCameraView", errorMsg, e)
try {
val context = appContext.reactContext
if (context != null) {
val crashFile = java.io.File(context.filesDir, "init_crash.txt")
crashFile.writeText(errorMsg)
}
} catch (ioe: Exception) {
// Ignore
}
}
}
@@ -106,10 +115,20 @@ class UsbCameraView(context: Context, appContext: AppContext) : ExpoView(context
onCameraReady(mapOf("status" to "ready"))
} catch (e: Exception) {
e.printStackTrace()
val errorMsg = "startPreview error: ${e.message}\n${android.util.Log.getStackTraceString(e)}"
appContext.currentActivity?.runOnUiThread {
android.util.Log.e("UsbCameraView", "startPreview error: ${e.message}")
android.util.Log.e("UsbCameraView", errorMsg)
onCameraError(mapOf("error" to (e.message ?: "Unknown error")))
}
try {
val context = appContext.reactContext
if (context != null) {
val crashFile = java.io.File(context.filesDir, "init_crash.txt")
crashFile.appendText("\n\n--- START PREVIEW CRASH ---\n$errorMsg")
}
} catch (ioe: Exception) {
// Ignore
}
}
}