Judge Steven O'Neill, who presided over the Cosby trial, ruled today that the names of the jurors will be released publicly with the condition that they "not disclose anything that was said or done in the jury room."
In his court order, the judge wrote, "Jurors shall not disclose arguments or comments made, or votes cast, by fellow jurors during deliberations.
The jurors will be contacted by the court and given the judge's directives before their names are released.
Philadelphia Media Network, which owns the newspapers The Philadelphia Inquirer and Philadelphia Daily News, originally filed a motion to release the names of the jurors. They were soon joined by other media outlets, including The Associated Press, CNN and The New York Times.
Pennsylvania law allows jurors' names to be released publicly, but judges have the discretion to keep them a secret under certain conditions.
Prosecutor Kevin Steele opposed the motion, arguing in documents filed Monday that releasing them would result in a "publicity onslaught" that would have a "chilling effect" on finding jurors for a second trial.
Philadelphia Media Network had urged the judge to release the names to "confirm the impartiality of the jury."
But Steele argued that it could have the opposite effect and "may make the parties' abilities to select a fair and impartial jury more difficult."
A mistrial was declared Saturday after the jury deliberated for 52 hours over six days and was unable to render a unanimous verdict.
Cosby had been charged with three counts of felony aggravated indecent assault.
During the six-day trial, Cosby's accuser, Andrea Constand, 44, testified that in 2004 Cosby gave her a drug at his home in Montgomery County, Pennsylvania, that rendered her unable to stop his alleged assaults.
Cosby pleaded not guilty to sexual assault and has denied any wrongdoing in this case and in other accusations.
None of the seven men and five women on the jury have come forward to speak publicly. How they voted on the case has also not been disclosed.
One alternate juror spoke to a Pittsburgh radio station, but he did not participate in the deliberations.
Steele has said he will retry the case.
"We will evaluate and review our case, take a hard look at everything involved and we will retry it," he said during a press conference shortly after the mistrial. "Our plan is to move this case forward as soon as possible."
He later added that "the judge has made some indications in court that he is looking to put this on track within 120 days. Legally we have 365 days to try the case."
Cosby's criminal defense attorney Brian McMonagle told ABC's "Good Morning America" on Monday that he was confident his client would be acquitted in a second trial.
"Trust it, believe in it, and I'm confident that if this case is retried, he'll be acquitted," McMonagle said.
Lawyers for Constand released a statement on Saturday after the hung jury result, thanking the district attorney's office and "the many police officers and detectives who worked on this case," as well as the "jury for their tireless efforts and ... their sacrifice."
"From the moment she revealed what had happened to her, Andrea sought to have this matter addressed in the criminal justice system," the statement added.
ABC News' Chris Francescani contributed to this report.