[Part 59 of the Flutter issue series] com.android.tools.idea.gradle.project.sync.idea.issues.SdkPlatformNotFound

This is the [59th article of the Flutter problem series]. If you find it useful, please pay attention to the column.

Current development environment
Flutter version: 2.2.3, Dart version: 2.13.4, OS: macOS Catalina 10.15.7 i9, Android Studio version: Arctic Fox 2020.3.1 Pathc 4.

One: problem description

In the current development environment, I open an Android project of a Flutter project, and after Android Studio automatically downloads the gradle configuration file, the prompt content is shown in the figure below.
insert image description here
Prompt content:

Gradle project sync failed.Basic functionality(e.g.editing,debugging) will not work properly

The translated meaning is that the Gradle project failed to sync. Basic functions (such as editing, debugging) will not work properly.

Then I tried various attempts with the content of the prompt, what project to configure maven in the build.gradlefile , or download the offline gradle package, or gradle.propertiesadd it to the file, android.enableR8 = trueetc. All failed, there is no way, then check what the problem is.

Two: Solutions

First let me tell you how to solve my problem, it's very simple, just need to download the SDK of Android 12 (API Android 31), as shown in the figure below,
insert image description here
then click in sequence File - Sync Project with Gradle Files, and wait for Android Studio to automatically download the relevant configuration, as shown in the figure below
insert image description here
The final rendering is as follows .
insert image description here
The content of the prompt has disappeared, and you're done. It would be great if your problem was solved in this way.

Three: problem analysis

The following is the process of solving the problem, if you are interested, you can take a look.

There is one in the upper right corner of the first picture Show Log In Finder, which means to display the output log in Finder. After clicking,
insert image description here
slide to the bottom of the log, as shown in the picture below, and the
insert image description here
prompt com.android.tools.idea.gradle.project.sync.idea.issues.SdkPlatformNotFoundExceptionis that Android 31 was not found, since it was not found. , then download an Android SDK corresponding to Android 31.

It can be seen that the log output time is 17:48, and there are still 12 minutes before get off work, but I did not give up on this problem. God still has pity on us, but I persevered.

Has your problem been resolved? Welcome to leave a message in the comment area.

Give someone a rose, and there is a lingering fragrance in your hand. If you think the article is good, I hope you can give a one-click three-link, thank you.


concluding remarks

Google's Flutter is getting more and more popular. As of January 15, 2022, the GitHub star has reached 134K. Flutter is resolutely a trend, so as a front-end developer, there is no reason not to learn as soon as possible.

Whether you are a Flutter novice or have already started, you might as well pay attention first. I will write the common components in Flutter (including source code analysis, component usage and precautions) and possible problems in the CSDN blog. I hope While learning by yourself, you can also help more people.

Supongo que te gusta

Origin blog.csdn.net/qq_42351033/article/details/122509273
Recomendado
Clasificación