Streetcomplete: Build bot ends up with different classes.dex than when building from source
Since about 2 weeks, new versions of my app StreetComplete started to crash with the error
java.lang.NoSuchFieldError: No field map of type Ljava/util/Map; in class Lorg/json/JSONObject; or its superclasses (declaration of 'org.json.JSONObject' appears in /system/framework/core-libart.jar)
(see https://github.com/westnordost/StreetComplete/issues/2007)
It looks as if a certain field of the class JSONObject from the org.json package is missing. As far as I know, org.json is bundled with Android, i.e. in the classpath available to apps running in the JVM.
I now found out, that only the F-Droid version of the app is affected by this. The version I build myself and anyone else can build from source on GitHub works just fine.
With Android Studio, it is possible to analyze APKs and see what's inside. I checked each the same version of my app built from source through Android Studio, built from source via the gradle task "build" and built by the F-Droid build bot. This is the outcome:
The builds created via the Android Studio UI and by running the gradle task are the same. But the F-Droid version differs, there are fewer methods defined. This may or may not be the reason for the aforemented crashes but so far it is the only lead I got as the problem is only reproducible with F-Droid builds.