Android crashing on v1.16.0

The latest Android app v1.16.0 frequently crashes on my Android 11 (May 5, 2021 security update) phone. The Syncthing app has been remarkably stable and smoothly functioning for years, so I am surprised by the behavior. I installed it via F-Droid.

I can’t find anything useful in the logs. There is a line like this

--------- beginning of crash
06-04 22:04:06.366 I/SyncthingNativeCode(28084): [start] INFO: syncthing v1.16.0 "Fermium Flea" (go1.15.9 android-arm64) vagrant@basebox-stretch64 2021-04-26 13:38:08 UTC [noupgrade, stguiassets, sthashing, stnoupgrade]

but no further information beyond the usual startup messages from when it restarts after the crash. I cannot determine what actions or circumstances lead to a crash; it seems random.

If it happens again, you can try to get logs using logcat.

1 Like

I installed a log reader but after many crashes and restarts I have not seen any Syncthing log messages at all. I also tried the previous Syncthing version v1.15.0 and experience the same crashing behavior, which indicates that there must be some conflict with the recent Android update I referenced above

I’m not sure if log reader apps work without root permission. Probably better to use adb

I used adb to grant the app permission to read the logs following the instructions provided in the app. It mentioned this was an alternative to rooting, but maybe that’s incorrect?

1 Like

Granting permission via adb to read logs is totally fine. (Only if you did not grant it, MatLog is limited to read its own logs only.)

I finally got a stack trace using Scoop. Here are the log messages:

FATAL EXCEPTION: main
Process: com.nutomic.syncthingandroid, PID: 20724
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at path $.data
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:226)
at com.google.gson.Gson.fromJson(Gson.java:932)
at com.google.gson.Gson.fromJson(Gson.java:1003)
at com.google.gson.Gson.fromJson(Gson.java:975)
at com.nutomic.syncthingandroid.service.RestApi.lambda$getEvents$12(RestApi.java:675)
at com.nutomic.syncthingandroid.service.-$$Lambda$RestApi$A22A7F2tuiG8xzqwONwkzIuFgy0.onSuccess(Unknown Source:2)
at com.nutomic.syncthingandroid.http.ApiRequest.lambda$connect$0(ApiRequest.java:98)
at com.nutomic.syncthingandroid.http.-$$Lambda$ApiRequest$PMSqTR1xIfC3Gvk4ksGvnlwcmKY.onResponse(Unknown Source:4)
at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:82)
at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:29)
at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:102)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7660)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at path $.data
at com.google.gson.internal.bind.JsonTreeReader.expect(JsonTreeReader.java:163)
at com.google.gson.internal.bind.JsonTreeReader.beginObject(JsonTreeReader.java:88)
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:183)
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:145)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
... 17 more

I believe the crash is caused by the new untrusted device feature. There is one folder shared with an untrusted device, and when I disable this share, the app stops crashing.

To be fair, there is not yet an interface in the Android app to configure untrusted device shares (I used the Web GUI view to do it), so I probably should have expected trouble.

1 Like