While electronics giants Apple and Samsung fight each other for market dominance, with hotly competitive product releases and tit-for-tat patent lawsuits, Japan’s consumer electronics makers find themselves in an increasingly perilous fight for relevance and, in some cases, survival.

Companies such as Sony, Panasonic and Sharp once controlled the industry, outclassing and outselling their U.S. rivals. But now they represent the most alarming telltale of corporate Japan’s ­two-decade struggle to adapt, downsize and innovate.

While the Japanese economy staggers, the consumer electronics companies are in an accelerated free fall, unable to catch on in the digital world of tablets and smartphones. They’re cycling through executives, watching their stock prices dip toward 10-year lows and laying off employees; Sharp recently reported plans to slash nearly one-fifth of its workforce. The companies — bleeding money on their once-profitable televisions — have also set off on a nontraditional hunt for profits, developing everything from solar panels to medical devices.

The companies still have famous brand names, and tech analysts say they still produce some of the world’s highest-quality hardware devices. But they face a fundamental problem: It’s been years since they’ve turned out products that people feel they need to have.

Those who study the consumer electronics industry describe a decade of missteps and miscalculations. Japan’s giants concentrated on stand-alone devices like televisions and phones and computers, but devoted little thought to software and the ways their devices synced with one another. As a result, their products don’t always work in harmony, in the way an iPhone connects naturally with a laptop and a digital music store.

Japan tech stocks plummet.

In other cases, the Japanese companies were simply too slow to turn cutting-edge technology into usable technology. Sony, for instance, was early to embrace e-book technology, but struggled to pair it with intuitive software or an easy-to-download selection of books. The companies also completely missed the rapid rise of smartphones, with Apple and South Korea’s Samsung grabbing the majority of the market.

Even the Japanese companies’ strengths matter less now, as consumers have lost the willingness to pay a premium for quality. Sharp and Sony and Panasonic make among the world’s best televisions, for instance, but such Korean competitors as LG and Samsung have found ways to make products that are almost as good for far less money.

“In the past there was a huge gap between the best of breed and second best,” said Michael Gartenberg, an industry analyst at Gartner, a technology research company. “Now, maybe there’s still a small gap between a Sony high-definition screen and an LG screen, but most consumers can’t see it. And if most consumers can’t see it, it’s not there.

“Japanese companies,” Gartenberg added, “were busy defending old business models that the world simply bypassed.”

The pace of problems is accelerating. Sony hasn’t made a profit in four years. Panasonic has lost money in three of the past four. Along with Sharp, the companies’ combined market value, according to Bloomberg, is $32 billion — making them one-fifth the value of Samsung and one-twentieth the value of Apple.

No company is faring worse than Sharp, which once ruled the liquid-crystal-display TV market and promised “to make products that others want to imitate.” Since 2008, its LCD sales have dropped 39 percent. Just weeks ago, as Standard & Poor’s cut Sharp’s credit rating to junk status, the company put its Osaka headquarters up as collateral to obtain loans.

Sharp had planned September as a banner month, marking the 100th anniversary of its founding. Sharp instead has spent the month asking management to take a 10 percent pay cut and employees to take a 7 percent cut. It has also mapped out a plan to sell off some overseas plants. More problematic, because the company has lost value so quickly — its stock falling 70 percent on the year — its executives are struggling to secure a much-needed cash infusion from Hon Hai Precision Industry, the Taiwanese electronics manufacturing company more commonly known as Foxconn.

In March, Hon Hai agreed to buy a 10 percent share in Sharp by purchasing stock — 67 billion yen in total ($864 million) — at 550 yen ($7.10) per share. But as that stock’s value dipped below 200 yen per share, Hon Hai demanded to renegotiate the deal. If Hon Hai now used the same 67 billion yen to buy up Sharp stock, it would control almost 30 percent of the company.

Hon Hai’s chairman, Terry Gou, traveled to Japan last month to iron out a reworked deal, but he returned abruptly with talks still at an impasse.

“We have no intention of giving away a larger controlling share,” Sharp President Takashi Okuda said in an interview this month with Nikkei Business Magazine.

Japan’s tech companies know their survival is at stake, and recent years have seen them take steps — including layoffs and, in Sony’s case, appointing Western executive Howard Stringer to run the company — previously unheard of in Tokyo’s hidebound corporate world.

But a more drastic step is only beginning to take shape: Though these companies have always been sprawling, producing everything from microwaves to cameras, they are now backing away from the very consumer electronics products that made them famous.

Sony and Panasonic have drastically cut their TV production. Sony’s life insurance arm was by far its most profitable segment last year, when it lost $5.9 billion because of flagging demand for electronics. Both Panasonic and Sharp are now selling solar panels. And Sharp is taking it a step further, laying out a plan in its 2012 annual report to “create ‘new essential products’ that people realize they always wanted” through a “shift in categories.” This means developing medical diagnostic imaging monitors, 3-D high-definition digital mirrors and electronic textbooks.

“Harnessing the creativity that flows through our corporate DNA,” Okuda wrote in a letter to shareholders, “we will . . . accelerate the global market launch of new one-of-a-kind products that will impress and amaze.”