mapbox / mapbox-maps-android

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.
https://www.mapbox.com/mobile-maps-sdk
Other
469 stars 131 forks source link

Most expression now show lint error "Incorrect number of expressions" #2373

Open SamYStudiO opened 5 months ago

SamYStudiO commented 5 months ago

Since mapbox Android 11.4.0

For example

circleColor(
    switchCase {
        eq {
            get { literal("type") }
            literal(RouteShapeWaypointType.AUTO.name)
        }
        color(Color.RED)

        color(Color.YELLOW)
    },
)

Here both switchCase and eq expression are concerned !!!

image

Incorrect number of expressions within switchCase Expression: expected an odd number, but 2 was found. More... (Ctrl+F1)

Incorrect number of expressions within eq Expression: expected 2 or 3, but 1 was found. More... (Ctrl+F1)
kiryldz commented 5 months ago

@SamYStudiO hey!

Since mapbox Android 11.4.0

What version did you use before moving to 11.4.0?

SamYStudiO commented 5 months ago

@SamYStudiO hey!

Since mapbox Android 11.4.0

What version did you use before moving to 11.4.0?

@kiryldz 11.3

kiryldz commented 5 months ago

@SamYStudiO I do not see similar issues and we did not modify those lint rules between v11.3 and v11.4. I assume that despite lint complaining - the code does compile OK, right?

SamYStudiO commented 5 months ago

@kiryldz It does compile ! I was coming from 11.3 but since i haven't tried to compile with 11.3 i may have missed the issue and so it may be anterior to 11.3

ittna commented 5 months ago

Maybe related to gradle update. At least I started getting these after updating to AGP 8.4.0.

jsoberg commented 4 months ago

I also started experiencing this after updating AGP to 8.4.1

NasH5169 commented 4 months ago

Same here.

If the expression is not too complex, you can change the way it is set:

from iconRotate(get { literal("heading") }) to iconRotate(Expression.get("heading"))

brianpowerkws commented 3 months ago

I had the same issue using gradle 8.2.0. Rolling back to 8.0 "solved" it for me. I spent 2 days smacking my head off that particular wall.

Incidentally, I think the documentation, examples and general developer experience of using the expression dsl in Compose is quite poor compared to most of the library. Its a shame considering the careful thought and effort that obviously went into the implementation.

No doubt it will be improved as maps-compose matures into the standard choice for green-field work.

kdaccenture commented 2 months ago

Any update?

am4-deus commented 1 month ago

AGP version: 8.5.2 Mapbox Android version: 11.6.0

I can report the same issue with the lint errors. The code compiles and all seams to work as expected, however the lint errors are annoying.

We started seeing this when we migrated from 10.16.1 to 11.6.0

josh-bartz commented 1 week ago

Gradle version: 8.7 AGP version: 8.6.1 Mapbox Android version: 11.4.1 and 11.7.0

Same. Started after updating gradle to 8.7 and AGP to 8.6.1