The flutter version rolls back or the sdk version cannot be packaged

For example, the previously packaged project needs to use the version of flutter sdk 2.8.1 to be packaged normally

However, using flutter doctor, it is found that the current version is higher, so the execution fails

 My project is running on a mac, so find the environment variable to see which flutter sdk version is being used

Open the terminal, and use vim ~/.bash_profile to open the environment variable that needs to be modified. Assuming that the address of the variable used is the normally packaged sdk address, then look at the environment variable in the vim ~/.zshrc file. Let’s talk about each zshrc file. It will be executed every time it is turned on, so you can also put all the variables in it and execute it. Assuming that the found variable path is still the same, then take a look at the sdk version used in as

Found that the sdk in as uses 3.0.1, modify it to the sdk version you need

 after modification

 Executing flutter doctor again still outputs 3.0.1,

The key operation is here, and the important thing is said three times: execute the following code in AS, execute the following code in AS, and execute the following code in AS!

source ~/.bash_profile or source ~/.zshrc (modified which one), if not modified, execute the last

Execute flutter doctor again and find that it is normal and can be packaged

Guess you like

Origin blog.csdn.net/as425017946/article/details/126706307
Recommended