ostrya / PresencePublisher

An Android MQTT client that regularly publishes messages to notify about the device's presence
MIT License
79 stars 12 forks source link

Crashes when trying to select networks #16

Closed darkphoenix closed 4 years ago

darkphoenix commented 4 years ago

This app works great on one of my Android phones, but on the other (Xperia XZ, running Android 8.0) it crashes instantly whenever I touch the "Target WiFi networks" option with no messages in the log. What might be causing this issue?

ostrya commented 4 years ago

I cannot say what is wrong there, but I added an UncaughtExceptionHandler to get a log output of every exception which crashes the app. I attached a snapshot build of this new functionality here, could you try it out and see what is written into the log?

darkphoenix commented 4 years ago

The crash generates the following error: 2019-11-21T20:09:39.424Z [ERROR/LogUncaughtExceptionHandler]: Thread[main,5,main] crashed due to java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String java.lang.CharSequence.toString()' on a null object reference

Also, on one occasion it generated this after restarting the app: 2019-11-21T20:09:40.837Z [ERROR/LogUncaughtExceptionHandler]: Thread[main,5,main] crashed due to java.lang.RuntimeException: Unable to start activity ComponentInfo{org.ostrya.presencepublisher.snapshot/org.ostrya.presencepublisher.MainActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x0 but I have not been able to reproduce that message since.

ostrya commented 4 years ago

Hm, that was less information than I hoped. I have modified the crash handler to also log the stacktrace, could you please try again?

app-snapshot.zip

darkphoenix commented 4 years ago

I am... very confused now. The crash does not occur with this snapshot, but I could reproduce it as soon as I downgraded again. It works just fine with the latest snapshot.

ostrya commented 4 years ago

Sorry for confusing you. I actually fixed up one part that looked like it might create a NullPointerException as sort of a lucky guess in the new snapshot, and it seems that was exactly the place that caused your problem. Will be in the next release :-)

darkphoenix commented 4 years ago

Yeah, I noticed that after taking a closer look at the changes in that commit. Guess I'll be running this snapshot build until the next release, thanks for fixing this so quickly!