OAKLAND, Calif. — After the team bus was caught in a massive traffic jam on the Bay Bridge from San Francisco, Carmelo Anthony strolled into Oracle Arena less than an hour before Thursday night’s game against the Warriors.

Anthony didn’t have to hurry in, though. The Knicks already had announced Thursday afternoon that Anthony was going to miss the game with a previously unrevealed right shoulder injury.

Anthony joined Derrick Rose (lower back stiffness) in street clothes. The Knicks, who had a tall task in upsetting Golden State at full strength, had little chance with Lance Thomas and Brandon Jennings in the starting lineup instead of Anthony and Rose and suffered a predictable 103-90 defeat.

The Knicks (14-12) were outclassed, but they were not blown out of the building until the third quarter, when the Warriors (23-4) built a 25-point lead.

Golden State had 41 assists (on 45 baskets). The Knicks had 19.

Said Jeff Hornacek, “I thought we played hard. Got to give them that . . . I’ve got to give our guys credit for at least trying hard and going out there knowing they’re undermanned without Carmelo and Derrick, but again, you’re still trying to win the game. I think the focus if we could have made some free throws — we were 9 of 19 from the free-throw line — to win on the road against a good team, you’ve got to have no turnovers and we only had 12, so that was OK, but usually you have to make all your free throws to have a chance to be in the game.”

advertisement | advertise on newsday

Golden State seemed to enjoy testing its most difficult and dazzling passes, some of which went awry. The Warriors also missed a startling number of layups in the early going. Kevin Durant ran out of his sneaker while turning the ball over. Stephen Curry missed his first six shots and didn’t score until 5:33 was left in the first half. Still, the outcome was never in doubt. The Knicks had three leads: 2-0, 4-2 and 6-5.

Klay Thompson had 25 points for the Warriors. JaVale McGee added 17 points and Durant had 15 points, 14 rebounds and eight assists. Curry contributed eight points, 10 rebounds and eight assists and Draymond Green had 11 rebounds and seven assists.

Justin Holiday had 15 points, Ron Baker 13 and Brandon Jennings 10 for the Knicks. Kristaps Porzingis shot 4-for-13 and was held to eight points in 35 minutes.

“I had some not great looks, but decent looks, that I missed, obviously,’’ Porzingis said. “I wasn’t getting those open threes that I usually do and I wasn’t able to do a lot of the stuff I usually do. Games like this, I’ve got to watch the film and then prepare next time. If I keep playing at this level and score the ball and so on, the defense is only going to get better, so I’ve got to be ready for that. I guess that’s how Melo feels every night.”

The Knicks, who are 2-2 on this western swing, end it Saturday night in Denver. They hope to have Anthony and Rose back.

The issue of NBA coaches resting their star players again took center stage this week when Cavaliers coach Tyronn Lue did not even bring LeBron James, Kyrie Irving and Kevin Love to Wednesday night’s game in Memphis.

Coincidentally, the Knicks and Anthony had been talking openly about their star getting a game off soon to rest. And eyebrows were raised Thursday when the Knicks suddenly announced that Anthony was out for that night’s game. But he said he did suffer a bruised shoulder Sunday when the Knicks played the Lakers.

“Even this morning,” he said, “when I was doing workouts and not being full strength, there was no way I could get out there tonight.”

Anthony said the injury, which he said might have occurred when he dived for a ball, has “totally, totally, totally, totally” affected his shooting. He shot 7-for-31 in the two games before Thursday night.

Before his injury was revealed, Anthony spoke about the possibility of taking a game off just to rest.“I think everyone needs a rest day, to be honest with you,’’ he said. “I think if you’re an NBA player, professional athlete, you need a rest day. It’s a matter of when you take it, how you take it. The decision is not just mine, it’s a collective as a whole. Whatever is the best situation for that individual.”

advertisement | advertise on newsday

Anthony played in all 25 previous Knicks games. He said he almost took off a game earlier in the season (it is not clear which one).

“You got to take a look at it,” Hornacek said. “We thought about it another time. He wanted to play. He’s a competitor. [The Cavaliers] have the luxury and cushion to do that. We’re not at that point yet. We’ll see how it goes. If he needs a break, we’ll give him a break.”

Warriors coach Steve Kerr led the crowd in a pregame “moment of joy” in honor of Turner Sports broadcaster Craig Sager, who died Thursday at the age of 65.