MarcusWolschon / osmeditor4android

Vespucci is a OpenStreetMap editor for Android
http://vespucci.io
Other
370 stars 83 forks source link

Javascript error message 'Function importClass must be called with a class' with Javascript presets #2613

Closed jajajaneeneenee closed 1 month ago

jajajaneeneenee commented 1 month ago

Vespucci Version

20.1.0 Beta3

Download source

Google Play Store

Device (Manufacturer and Model)

Samsung A33

Android Version

14

Behaviour/Symptoms

When I use a Javascript preset for the first time after starting Vespucci (e.g. "Set to disused" from the Simonpoole Beautified Presets), I always get this error message:

Function importClass must be called with a class; had "[JavaPackage com.mapbox.turf.TurfMeasurement]" instead. (Source file #26)

Screenshot_error_message

I've never seen this message before.

Note: And there is a key "set_to_disused" without a value in the property editor (= name of the Javascript text in the preset "Set to disused").

Quite strange (for me): If choosing the Javascript preset again, everything is fine. And it works without a problem until Vespucci is quit by closing it in the recent apps list of Android (closing it with with the back button pressed two times and confirming the message "Exit Vespucci Are you sure you want to exit?" will keep it working fine after restarting). But I have never understood why it is so hard to really close an application in Android and what the differences are.

How to recreate

To reproduce the problem, I have to close Vespucci from the recent apps list and restart it. And then use a Javascript preset with an object.

Crash dump submitted (no or yes + date)

no

jajajaneeneenee commented 1 month ago

Is there still some clarification needed? Could you reproduce it?

It started with v20.1 ... I hope it won't be in the final version of 20.1 (which has some very nice improvements like rotating multiple objects ...).

simonpoole commented 1 month ago

You'll need to provide a script that shows the issue, it isn't reproducible with any of the "standard" ones here.

jajajaneeneenee commented 1 month ago

Here it is 100% reproducible. I tried it again with „Simonpoole Beautified JOSM Preset“, last release (v5.55.1) and the Javascript item “Set to disused” (Vespucci 20.1.0 Beta3).

The first time I use it, I get the error message (and the selected object is not changed, I tried it with a shop node). When I tap “Set to disused” a second time (still in the property editor), it's working fine. And then with other objects too (no error message), even if I use e.g. “Set to abandoned”.

If I quit Vespucci (with the back button 2 times) and restart it, I still don't get an error message! If I quit Vespucci (with the back button 2 times), and remove it from the recent apps list, and restart it, I got the error message again. I tried this 2 times now, it also seems to be reproducible.

jajajaneeneenee commented 1 month ago

Should I really post the “Set to disused” Javascript here? (For information: no change in 20.1.0 Beta4).

simonpoole commented 1 month ago

No, but as said it currently isn't reproducible here, so we need to narrow things down. In this case I would suggest disabling any other presets for starters

simonpoole commented 1 month ago

This is actually a proguard/R8 issue (one of those things we unluckily can't automatically test for).

jajajaneeneenee commented 1 month ago

Don't understand completely ... but partially ...

Could you fix it?

(Of course, I disabled any other presets when testing.)