LOS ANGELES — When Robert Redford first acquired the film rights to Bill Bryson’s memoir “A Walk in the Woods,” he knew exactly who he wanted to play his Appalachian Trail hiking comrade: Paul Newman.

Not only were the two men responsible for some of cinema’s most iconic duos — they were lifetime friends as well.

But the 11-year age difference was starting to become a problem. Newman, whose health was in decline, was afraid he wouldn’t be up for the physical challenges of the role. When Newman died in 2008, the project nearly died, too.

And then The Sundance Kid met Nick Nolte.

However strange it might sound for two contemporaries with long-running careers, Nolte and Redford didn’t actually know one another.

“I liked him as an actor. You could see that he had an undisciplined side in life,” said Redford.

Redford cast Nolte in his 2012 political thriller “The Company You Keep,” they hit it off, and “A Walk in the Woods,” out next Wednesday, came off the shelf again.

Nolte was actually a better fit for the part of Stephen Katz anyway — Bryson’s messy, out of shape, ex-friend who accompanies him on a misguided trek on the 2,160-mile footpath.

“Our backgrounds were very similar before I got my act together. I got my act together somewhere along the line, but earlier in my life I was a mess — undisciplined, out for adventure and risk. I pulled it together, but I could identify with that part of Nick,” said Redford.

Director Ken Kwapis said in the rehearsal process the two actors used their own personal histories to fill in the gaps of their characters.

“Part of the pleasure of watching Bob and Nick is reflecting on their respective filmographies. On one hand, the film is about moving forward in life, but on the other, it’s about two guys taking stock of where they are in life,” said Kwapis.

Redford, who just turned 79, reflects on some of his classic two-handers on the eve of the release of his latest buddy adventure:

‘Butch Cassidy and the Sundance Kid’ (1969)

“We played partners who bitched and moaned at each other but who were loyal to each other. I thought that was a nice dynamic,” said Redford, who first met Paul Newman on the project.

“The studio didn’t want me because I was not a name equal to Paul’s. I was just sort of moving up at that time. There was a big argument that went on for months and months. They said it had to be a star. (Newman) said, ‘Well, I want to work with an actor’ because Paul respected acting. Had it not been for Paul, I would not have gotten that break,” he said.

‘The Sting’ (1973)

“After ‘Butch Cassidy’ we became very close friends. ‘The Sting’ just sort of fell into place naturally,” said Redford. “What was interesting was the switcher-o. Paul had played these iconic, quiet, still characters in the past and that’s not what Paul is. He was a chatty, nervous guy who was always biting his fingernails. He always had tape on his fingernails. He used to chain smoke, before he stopped smoking, and was always drinking beer. He was a very nervous guy. He loved to have fun and play games,” said Redford.

“He loved to tell jokes that were so awful. He’d tell you a joke at 11 o’clock and he’d be the only guy laughing. And then he’d tell the same joke again at 2, forgetting that he’d already told it. We had to live through that,” he said. “But underneath all that was a slow connecting between Paul and me as actors.”

‘All the President’s Men’ (1976)

“The history of that project is almost more interesting than the project,” said Redford.

He started obsessing over the saga during a whistle stop tour for “The Candidate” when he overheard some journalists gossiping about the DNC break-in. When Redford asked what they were going to do about it, he was appalled at their apparent disinterest in poking around the suspicious situation. Redford continued to follow the story in the papers and was struck by the double byline of Bob Woodward and Carl Bernstein.

“I wanted to know who these guys were, who created all this disturbance,” said Redford. “I read an article in some minor publication and I thought, ‘Wow, one guy was a Jew, one guy was a WASP. One guy was a Republican, the other guy was a liberal. One guy was a good writer, the other wasn’t very good. They didn’t like each other, but they had to work together. Now that’s an interesting dynamic I’d love to know about.’”

Redford wanted to cast two unknowns, but the studio wouldn’t do it without Redford starring.

“So I went to Dustin Hoffman.”