HONG KONG — Starbucks has a China problem: coffee and tea drinkers who want more for less.

Vivian Yan tried her first Starbucks coffee eight years ago. She was desperate for a jolt of caffeine at work, and the store was nearby.

“It didn’t necessarily mean I love Starbucks,” she said, “nor was it my first choice.”

These days, she thinks a cup of Starbucks is a little too expensive and prefers to get her coffee from McDonald’s.

But what she really loves is ChaGee, HeyTea and other Chinese chains that sell coconut milk lattes; boba milk teas with cheese cream; and sugary jasmine tea frappés.

“They are delicious and offer more choices,” said Yan, 35, who is from China’s eastern province of Jiangsu.

Yan’s preference for more diverse flavors poses an acute challenge for Starbucks.

It is losing customers at a rapid pace. Brian Niccol, the new CEO, sounded the alarm in October, calling the competition “extreme” in the company’s second-biggest market behind the United States.

When Starbucks opened its first shop in China in 1999, tea dominated and coffee culture was practically nonexistent. But the company quickly built a thriving market alongside a swelling middle class that was turning to iPhones, Gucci handbags and other international brands to signal its newfound wealth.

Today, consumers are less interested in foreign brands, more cost conscious and enticed by local rivals that are popping up on corners, offering something a little different, all around the country.

Dozens of competitors to Starbucks spin out new flavors of tea and coffee every week at lower prices, creating competition so ferocious that Starbucks saw a 14% plunge in same-store sales in China in its most recent financial quarter.

Luckin Coffee, a Chinese brand that started seven years ago, now generates more revenue in the country than Starbucks, which brings in around $3 billion in annual sales in China.

Luckin Coffee has nearly three times as many stores as Starbucks’ 7,600 outlets, and opens a new one, on average, every hour.

Starbucks has diversified its menus in China, offering more milk teas and flavors that cater to local tastes, but they are typically more costly than their competitors and have occasionally missed the mark.

Many young consumers in China are also eschewing foreign brands in favor of Chinese companies amid a wave of nationalism known as guochao, or Chinese fad.

The country’s leaders have a history of dialing up the patriotism with propaganda during moments of tension with other countries.

If President-elect Donald Trump follows through on his promise to impose tariffs on all products going into the United States from China, the government in Beijing could turn on American brands.

In a nod to this, Starbucks, which offers more American-centric drinks like Pumpkin Spice Latte in its stores in China, recently said its business faced risks from “escalating U.S.-China tension and increased anti-Americanism, potential tariff increases, retaliations, restrictive regulations or boycotts, and increasing political sensitivities in China.”