Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

LONDON — Donald Trump seemed on the verge of an unlikely bromance with the Chinese president during their meeting at Trump’s Florida resort in April.

Fast forward three months, and Trump is firing written salvos at Beijing, signaling this rapprochement is fraying over the subject of North Korea, which earlier this week test-fired its first intercontinental ballistic missile.

Trade between China and North Korea grew almost 40% in the first quarter. So much for China working with us - but we had to give it a try! — Donald J. Trump (@realDonaldTrump) July 5, 2017

His criticism comes days before he is expected to meet President Xi Jinping again in Germany on the sidelines of the G-20, a summit of the world's largest industrial and developing nations.

Their head-to-head comes at a time when their countries appear as divided as ever on the issues of trade as well as North Korea — problems that analysts say will be hard to resolve.

"The way forward is an extremely tricky one," said Professor Steve Tsang at the School of Oriental and African Studies, a London university also known as SOAS.

"The risk of miscalculation from all sides is extremely high," he said.

Trump's recent tweet appeared to be criticizing China for not doing enough to halt North Korea's nuclear weapons program.

In a speech in Poland on Thursday, Trump doubled down, promising to confront North Korea "very strongly" for its latest missile launch, which marked a significant step forward in its nuclear ambitions and represented an escalation in the standoff with the West.

Isolated and impoverished, North Korea relies almost entirely on Chinese trade to survive and thus develop its rapidly advancing weapons program.

After his meeting with Xi in April, Trump appeared to be under the impression that China would do more to hold North Korea to account.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

He called Xi a "good guy" and said they "had good chemistry" after the pair shared chocolate cake.

"We have developed a friendship, I can see that," he said. "I think long term we are going to have a very, very great relationship and I look very much forward to it."

Trump's latest tweet signaled a clear shift in tone. Experts in China certainly see it that way.

"President Trump is known to be highly volatile in his temperament as well as his way of dealing with domestic and international matters," said Victor Gao, director of the China National Association of International Studies.

Gao's think tank is officially tied to the Chinese Foreign Office but he is seen as a relatively impartial voice inside the communist nation.

"If there is a high level of volatility, frivolousness and lack of sincerity in dealing with China-U.S. relationship, then both countries will suffer," he added.

President Donald Trump welcomes Chinese President Xi Jinping to the Mar-a-Lago estate in West Palm Beach, Florida, on April 6. Jim Watson / AFP - Getty Images

It's not the first time Trump has spoken harshly about China.

During his campaign, he accused Chinese trade policies of raping the U.S., and he has continually pushed the country to do more on North Korea.

When he got into the White House, he also took the unprecedented step of speaking with the president of Taiwan on the telephone — breaking decades of protocol.

Following the detente after the Mar-a-Lago meeting, Trump appears to have reverted to this hostile stance.

Last week, the U.S. signed off on a $1.4 billion arms deal with Taiwan, which prompted Chinese officials to say they had "every right to be outraged" at the sale.

Days later, the U.S. sailed a guided-missile destroyer close to a disputed island in the South China Sea that is claimed by Beijing and others. China called this a "serious military provocation."

"This is the U.S. saying, 'If you do not play ball we can make life difficult for you,'" said Tsang at SOAS.

President Donald Trump and Chinese President Xi Jinping walk together at the Mar-a-Lago estate in West Palm Beach, Florida, on April 7. Jim Watson / AFP - Getty Images

China did appear to move on North Korea in February when it banned all coal imports from the country. But analysts say the regional giant is reluctant to squeeze its neighbor too hard.

"The Chinese are not going to do what Trump thought China would do," Tsang at SOAS said. "I do not think for one second that Mr. Xi had any intention of reining in North Korea."

Theories as to why this is differ. Some say Beijing is fearful of a war on its doorstep, principally because it might spark an influx of North Korean refugees and place U.S. troops closer to its border.

Others, such as Tsang, reject this. He thinks that China does not want to see North Korea's communist regime fall because, as its supporter, its failure would undermine the domestic legitimacy of the Communist Party of China.

In response to Trump's tweets, the Chinese foreign ministry said Wednesday that it wanted to solve the issue with a "peaceful settlement through dialogue and consultation."

Perhaps in reference to Trump's outspoken style, it added: "We hope all relevant parties can stay calm and exercise restraint, refrain from words and deeds that may heighten tensions."

For now, all eyes will be on Trump and Xi's meeting at the G-20.

Although the pair may cover many issues, Gao said: "I think DPRK will be on the top of the list," using North Korea's official name, the Democratic People's Republic of Korea.