Johnson & Johnson and its pharmaceutical subsidiary, Janssen, agreed to a $20.4 million settlement with two Ohio counties Tuesday in an effort to avoid a lengthy and costly federal trial about the opioid addiction epidemic.

The opioid manufacturer company said the settlements with Cuyahoga and Summit counties include no admission of liability and removes the Johnson & Johnson from the federal trial scheduled to begin this month in the Northern District of Ohio, according to a news release.

"The settlement allows the Company to avoid the resource demands and uncertainty of a trial as it continues to seek meaningful progress in addressing the nation’s opioid crisis," Johnson & Johnson said Tuesday.

Johnson & Johnson will pay a combined $10 million settlement in addition to reimbursing the counties $5 million for costs used to prepare for litigation and donating another $5.4 million in charitable contributions to non-profit organizations in connection with opioid-related programs.

A number of companies are scheduled to face federal trial Oct. 21 in the U.S. Northern District of Ohio over whether manufacturers of prescription opioids misrepresented the risks of long-term opioid use.

An Oklahoma judge ruled against Johnson & Johnson in a similar case in August, ordering the corporation to pay $572 million to the state. Judge Thad Balkman's decision accused Johnson & Johnson and its subsidiary of pushing doctors to prescribe opioids while downplaying the risks of addiction.

In Balkman's full written decision, he stated that the pharmaceutical company's sales program was designed to reach doctors multiple times throughout their careers. J&J pushed an "education" program through sales representatives, funded articles in medical journals and paid speakers.

None of these programs properly addressed the risks of addiction and there was no training provided to sales representatives on the history of opioid use or addiction, according to the court's ruling.

"The Defendants’ opioid marketing, in its multitude of forms, was false, deceptive and misleading," according to the written decision.

Johnson & Johnson said after the decision that it will appeal the ruling.

Purdue Pharma, the company that made billions selling the prescription painkiller OxyContin, filed for bankruptcy in September after reaching a multi-billion dollar tentative settlement. The filing may also remove Purdue Pharma from the Oct. 21 federal trial as any parties who wish to seek damages from the corporation with have to go through bankruptcy court.

The painkiller manufacturer is still spending millions as it defends itself in lawsuits from 2,600 governments and other entities. Twenty-four states and the District of Columbia have not signed on to the proposal to settle the suits, according to state officials.