Russell Crowe, left, plays a beefy hired goon and Ryan Gosling a bumbling gumshoe in the uneven but often giddy “The Nice Guys.” (Daniel McFadden/Warner Bros. Pictures)

There was some grumbling among the purists at the Cannes Film Festival that “The Nice Guys,” a rakish, knockabout action comedy that premiered there last weekend, had no place among the auteurs and art-house cognoscenti swanning up the red carpet.

In actuality, “The Nice Guys” dovetails perfectly with the side of Cannes we don’t often see: the scruffy, decidedly un-red-carpeted market, where movies of questionable artistic merit are bought and sold amid the barking aggression of a carnival sideshow. An uneven but often ingratiatingly giddy throwback to ’70s crime movies and Abbott-and-Costello slapstick, “The Nice Guys” centers on not only the shadier circles of the movie business but also a trade show whose elaborate come-ons uncannily resemble the tawdrier precincts of Cannes itself.

Directed by Shane Black from a script he wrote with Anthony Bagarozzi, “The Nice Guys” stars Ryan Gosling as bumbling gumshoe Holland March and Russell Crowe as beefy hired goon Jackson Healy, who run afoul of each other in 1977 Los Angeles while following intersecting cases, then wind up in cahoots in search of a missing teenage girl. March himself happens to be the father of a 14-year-old daughter — played with scene-stealing composure by Angourie Rice — who has a habit of tagging along on his jobs, in this case having to do with pornography, multiple murders and the recent invention of the catalytic converter.

And yes, all of that does add up in a movie that, with so many moving parts, possesses a choppy, hit-and-miss tone, trotting out appallingly tasteless groaners one minute, then spinning on a tarnished dime to deliver genuinely droll, well-choreographed gags. The approach will work fine for anyone who doesn’t mind (or can at least tolerate) watching a bloodied, pointedly big-bosomed woman gasping for her last breath or someone being casually shot for laughs by mistake through a window.

Set in 1970s Los Angeles, private eye Holland March (Ryan Gosling) and hired enforcer Jackson Healy (Russell Crowe) must work together to solve the case of a missing girl. (  / Warner Bros. Pictures)

It will also seal the deal for Gosling fans who are convinced that the handsome young actor can do anything: Here, he solidifies his chops as a fleet, self-deprecating comedian as comfortable with dumb-sounding dialogue (he’s the Costello of the duo) as he is with carefully timed but seemingly spontaneous physical comedy. As he showed during moments of “The Big Short,” Gosling is an adept vocal performer, often sending his voice into a castrato-like upper octave to register shock, anger or mere confusion.

Crowe, for his part, is the soft-spoken straight man in “The Nice Guys,” a role he accepts with gracious, somewhat bloated, always bleary-eyed resignation. When the movie gets cooking, he and Gosling develop easy, unforced chemistry, resulting in memorably wacky set pieces involving a bathroom stall, an environmental “die-in,” a superbly staged moment in a hotel elevator and an antic chase through the revolving stages of a car show.

As a grab bag of visual and aural callbacks to the ’70s (the soundtrack features choice cuts from Earth, Wind & Fire and the Bee Gees, among others), “The Nice Guys” does a slapdash but ultimately winning job of interweaving the era’s anything-goes pop culture and post-Watergate politics; too sunnily goofy to be cynical, it can’t be described as particularly optimistic or humanist, either.

The characters in “The Nice Guys” often ask each other if they’re good or bad, a choice the movie doesn’t want to force the audience to make. Instead it settles for making good on the title, occupying the nice, mushy middle — perhaps unfocused and off-balance at times, but conveying a sense of buoyancy that’s as cheerfully contagious as it is freewheeling.

R. At area theaters. Contains violence, sexuality, nudity, profanity and brief drug use. 116 minutes.