You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just noticed that the video I had attached failed to upload. My bad! I sent both the video and a bug report dump to your email! Hope that helps!
Ohh no no it was uploaded, I deleted it because it had some personal info of yours... I guess it's something I'm gonna have to deal with a lot in this project 😁
I just noticed that the video I had attached failed to upload. My bad! I sent both the video and a bug report dump to your email! Hope that helps!
Ohh no no it was uploaded, I deleted it because it had some personal info of yours... I guess it's something I'm gonna have to deal with a lot in this project 😁
Oh, sorry! It's all public info, though, and most if not all of that info is attached to my git profile lol
Just found the same bug on my Galaxy A17 running Android 16. Although I cannot seem to replicate it on a Galaxy S24 running Android 16. Looks lite a issue linked to RAM or CPU.
Found it, Finally play console reported the crash logs
Exception cb2:
at com.google.zxing.WriterException.<init> (WriterException.java:31)
at com.google.zxing.qrcode.encoder.Encoder.chooseVersion (Encoder.java:320)
at com.google.zxing.qrcode.encoder.Encoder.recommendVersion (Encoder.java:218)
at com.google.zxing.qrcode.encoder.Encoder.encode (Encoder.java:152)
at com.google.zxing.qrcode.QRCodeWriter.encode (QRCodeWriter.java:78)
at com.sameerasw.medrop.utils.QrCodeGenerator.generateQrBitmap (QrCodeGenerator.java:34)
at com.sameerasw.medrop.ui.sheets.MeDropBottomSheetKt$MeDropBottomSheet$8$1$1.invokeSuspend (MeDropBottomSheet.kt:261)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:101)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run (LimitedDispatcher.java:113)
at kotlinx.coroutines.scheduling.TaskImpl.run (Tasks.kt:89)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely (CoroutineScheduler.java:589)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask (CoroutineScheduler.kt:823)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker (CoroutineScheduler.kt:720)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run (CoroutineScheduler.kt:707)
Summary
The application crashed due to an unhandled com.google.zxing.WriterException during the QR code generation process. This exception was thrown by the ZXing library’s Encoder.chooseVersion method, which is called internally when trying to determine the appropriate size (version) of the QR code for the provided data. This failure typically occurs when the input string contains too much data to fit within the maximum allowed capacity of a standard QR code, or when the combination of data size and the requested Error Correction Level (ECL) exceeds the capacity limits of the library. The crash occurred asynchronously within a Kotlin coroutine triggered from the MeDropBottomSheet UI component.
Potential Solutions
Implement Exception Handling in the QR Generator
A try-catch block should be implemented around the QRCodeWriter.encode call inside the QrCodeGenerator.generateQrBitmap method. Since WriterException is a checked exception, failing to catch it causes the application to crash when the QR code generation fails. By catching this exception, the method can return null or a fallback image, allowing the UI to handle the failure gracefully instead of terminating the app. The calling coroutine in MeDropBottomSheet.kt can then check for a null result and display an appropriate error message to the user.
public Bitmap generateQrBitmap(String content, int width, int height) {
try {
QRCodeWriter writer = new QRCodeWriter();
BitMatrix bitMatrix = writer.encode(content, BarcodeFormat.QR_CODE, width, height);
// Code to convert bitMatrix to Bitmap...
return bitmap;
} catch (WriterException e) {
// Log the exception and return null to prevent a crash
return null;
}
}
Optimize the Error Correction Level
The error correction level of the QR code should be explicitly configured to a lower setting, such as ErrorCorrectionLevel.L (Low) or ErrorCorrectionLevel.M (Medium). High error correction levels (like ErrorCorrectionLevel.H) consume a significant portion of the QR code's capacity for recovery data, leaving less space for the actual payload and triggering the chooseVersion exception. By reducing the error correction level, more data can be packed into the QR code before the maximum version limit is exceeded. This configuration is passed to the QRCodeWriter.encode method using an encoding hints map.
Validate and Truncate Input Data
Input validation must be performed on the text string before it is passed to the QR code generator. The maximum capacity of a QR code is strictly limited, and if the input data is dynamically generated (such as long URLs or large payloads) and exceeds this limit, the encoder will fail. Validating the length of the string beforehand ensures that unsafe data is rejected or truncated prior to attempting the encoding process.
public Bitmap generateQrBitmap(String content, int width, int height) {
// Standard limit for alphanumeric QR codes with low error correction is 4,296 characters
if (content == null || content.trim().isEmpty() || content.length() > 2953) {
return null;
}
// Proceed with encoding...
}
Activity
sameerasw commentedon Aug 28, 2026
Ohhh that is interesting... I think there might be some data being problematic... I might need some better parsing for the QR... Will look into that
Adithr123 commentedon Aug 28, 2026
I just noticed that the video I had attached failed to upload. My bad! I sent both the video and a bug report dump to your email! Hope that helps!
sameerasw commentedon Aug 28, 2026
Ohh no no it was uploaded, I deleted it because it had some personal info of yours... I guess it's something I'm gonna have to deal with a lot in this project 😁
Adithr123 commentedon Aug 28, 2026
Oh, sorry! It's all public info, though, and most if not all of that info is attached to my git profile lol
mariohdel14nasa-lang commentedon Aug 29, 2026
Just found the same bug on my Galaxy A17 running Android 16. Although I cannot seem to replicate it on a Galaxy S24 running Android 16. Looks lite a issue linked to RAM or CPU.
sameerasw commentedon Aug 31, 2026
Found it, Finally play console reported the crash logs
Summary
The application crashed due to an unhandled com.google.zxing.WriterException during the QR code generation process. This exception was thrown by the ZXing library’s Encoder.chooseVersion method, which is called internally when trying to determine the appropriate size (version) of the QR code for the provided data. This failure typically occurs when the input string contains too much data to fit within the maximum allowed capacity of a standard QR code, or when the combination of data size and the requested Error Correction Level (ECL) exceeds the capacity limits of the library. The crash occurred asynchronously within a Kotlin coroutine triggered from the MeDropBottomSheet UI component.
Potential Solutions
A try-catch block should be implemented around the QRCodeWriter.encode call inside the QrCodeGenerator.generateQrBitmap method. Since WriterException is a checked exception, failing to catch it causes the application to crash when the QR code generation fails. By catching this exception, the method can return null or a fallback image, allowing the UI to handle the failure gracefully instead of terminating the app. The calling coroutine in MeDropBottomSheet.kt can then check for a null result and display an appropriate error message to the user.
The error correction level of the QR code should be explicitly configured to a lower setting, such as ErrorCorrectionLevel.L (Low) or ErrorCorrectionLevel.M (Medium). High error correction levels (like ErrorCorrectionLevel.H) consume a significant portion of the QR code's capacity for recovery data, leaving less space for the actual payload and triggering the chooseVersion exception. By reducing the error correction level, more data can be packed into the QR code before the maximum version limit is exceeded. This configuration is passed to the QRCodeWriter.encode method using an encoding hints map.
Input validation must be performed on the text string before it is passed to the QR code generator. The maximum capacity of a QR code is strictly limited, and if the input data is dynamically generated (such as long URLs or large payloads) and exceeds this limit, the encoder will fail. Validating the length of the string beforehand ensures that unsafe data is rejected or truncated prior to attempting the encoding process.
mariohdel14nasa-lang commentedon Aug 31, 2026
Just tried the first one. It doesn't work but the implementation is very rough so I don't know
mariohdel14nasa-lang commentedon Aug 31, 2026
Just fixed it! (With a little vibecoding tho) https://github.com/mariohdel14nasa-lang/Essential-Tap
fix #1 : automatically adjust QR expected size based on data