CodeMinion / another_brother

Another Brother Flutter SDK
BSD 3-Clause "New" or "Revised" License
21 stars 19 forks source link

Runtime exception raised in the Google Play console #72

Closed alaindeseine closed 3 months ago

alaindeseine commented 10 months ago

Hi @CodeMinion ,

I get an error raised in play console this last days. No problem so far, just the last few days.

Error type is: java.lang.NullPointerException

Stacktrace is:

Exception java.lang.NullPointerException: bluetoothDevice.name must not be null
  at com.rouninlabs.another_brother.method.GetBluetoothPrintersMethodCall$execute$1.invokeSuspend (GetBluetoothPrintersMethodCall.java)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (BaseContinuationImpl.java)
  at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.java)
  at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely (CoroutineScheduler.java)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask (CoroutineScheduler.java)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker (CoroutineScheduler.java)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run (CoroutineScheduler.java)

I have take a look at source code and it seems like the printer modelName is empty.

Here is the source code i use to detect BT printers :

     List<brother.BluetoothPrinter> printers =
        await printer.getBluetoothPrinters(
      [
        brother.Model.QL_820NWB.getName(),
        brother.Model.TD_2125NWB.getName(),
      ],
    );

The problem seems to arrive exclusively on OPPO OPD4A1L1 (OPPO Reno7 5G/Find X5 Lite) device, running Android 13 API 33.

Have you noticed this error before?

Sincerely, Alain Deseine.

CodeMinion commented 10 months ago

Hi @alaindeseine ,

Thank you for reporting this issue. I have released version 2.1.1 of another_brother, that will properly handle the cases where the device name is null but this seems to be a deeper issue. I found a mentions of cases where BT devices are reporting a null name in Android 13 https://issuetracker.google.com/issues/240485116?pli=1

So while with this version you will not see the error, it's likely the printers won't appear while running in Android 13 in those devices.

Thanks again for the support,

alaindeseine commented 10 months ago

Hi @CodeMinion,

Thanks for replying.

I will update the lib as soon as possible.

Thanks again.

Sincerely, Alain Deseine.