Johnson & Johnson announced Tuesday that it had reached a $20.4 million agreement to settle opioid claims brought by two Ohio counties, becoming the fifth drugmaker to avoid the first federal trial that attempts to hold the pharmaceutical industry accountable for the drug scourge.

The company — which made a fentanyl patch and two versions of an opioid tablet — did not admit wrongdoing. It said in a statement that it was settling “to avoid the resource demands and uncertainty of a trial as it continues to seek meaningful progress in addressing the nation’s opioid crisis.”

The division of Johnson & Johnson that made the opioid products, Janssen Pharmaceuticals, has said that those products accounted for less than 1 percent of total opioid prescriptions written in the United States.

The settlement was not nearly as sizable as the tentative agreement reached by Purdue Pharma with opioid plaintiffs last month, but that deal was intended to release the company from all federal litigation and many state cases as well.