david yang
david yang

Reputation: 331

flutter packages get failed depends on flutter_test any from sdk which requires SDK version <2.0.0, version solving failed

I create a flutter project, and run flutter packeages get,the output as below: [second] flutter packages get Waiting for another flutter command to release the startup lock... Running "flutter packages get" in second... The current Dart SDK version is 2.0.0-dev.63.0.flutter-4c9689c1d2.

Because second depends on flutter_test any from sdk which requires SDK version <2.0.0, version solving failed.
pub get failed (1)
exit code 1

flutter doctor -v

PS D:\dartstudy\second> flutter doctor -v
[√] Flutter (Channel dev, v0.5.7, on Microsoft Windows [Version 6.1.7601], locale zh-CN)
    • Flutter version 0.5.7 at E:\flutter
    • Framework revision 66091f9696 (2 weeks ago), 2018-07-09 12:52:41 -0700
    • Engine revision 6fe748490d
    • Dart version 2.0.0-dev.63.0.flutter-4c9689c1d2

[√] Android toolchain - develop for Android devices (Android SDK 28.0.1)
    • Android SDK at f:\Android\Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.1
    • ANDROID_HOME = f:\Android\Sdk
    • Java binary at: E:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
    • All Android licenses accepted.

[√] Android Studio (version 3.1)
    • Android Studio at E:\Program Files\Android\Android Studio
    • Flutter plugin version 26.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] VS Code, 64-bit edition (version 1.25.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 2.16.0

[!] Connected devices
    ! No devices available

! Doctor found issues in 1 category.

the IDE that I use to create a project is VS code. I changed some versions of flutter sdk, the problems are the same as above,How to fix this problem?

Upvotes: 33

Views: 129465

Answers (13)

Thaddeus Onindi
Thaddeus Onindi

Reputation: 1

Try replacing geoflutterfire: ^3.0.3 to geoflutterfire2: ^2.3.15, it worked for me

Upvotes: 0

kokyedake
kokyedake

Reputation: 1

Inspect correctly your "pubspect.yaml" it's possible

Upvotes: -6

danPyk
danPyk

Reputation: 671

I have resolved this by adding integration_test above test declaration, I saw this solution in official codelabs: https://codelabs.developers.google.com/codelabs/flutter-app-testing#2

As on pic:

screenshot

I think this is a better way, than downgrading the plugin by using 'any' or changing flutter channel.

Upvotes: 0

Kalidas VijayBhak
Kalidas VijayBhak

Reputation: 19

Just upgrade flutter to the latest version. This solved the problem for me.

flutter upgrade //for upgrading flutter enter this in CLI.

Upvotes: 1

Bensal
Bensal

Reputation: 4130

I solved my error by using any instead of the version codes like this

flutter_test: any

instead of

flutter_test: ^1.1.0+1

Upvotes: 9

Sandeep Peddi
Sandeep Peddi

Reputation: 119

Maybe your Flutter SDK is not in the latest version. upgrade it by below command (and the documentation says, it is preferred to keep stable channel, upgrade to dev only if it essential)

flutter upgrade

Upvotes: 0

Levels-JD
Levels-JD

Reputation: 36

So here are some options to consider in solving this issue:

If you have tried the above solutions and it didn't work, then

  1. You probably have issues with your flutter SDK and need to fix that first. You have changes in your flutter SDK.

To fix this, kindly cd into your flutter directory. For instance D:\repo\flutter Find out what git changes you have in this directory using git status

Use git add * to add these changes (files) and then do git stash

To ensure that you're on the latest build from this channel, run flutter upgrade

You should be able to switch to any of your flutter channels

Stay safe. All the best

Upvotes: 0

Ahmed Khaled Abdalla
Ahmed Khaled Abdalla

Reputation: 21

I have the same issue and flutter upgrade --force fixed the problem.

Note: re-run the command flutter pub get after upgrading your flutter version.

Upvotes: 0

Hussein Al-Mosawi
Hussein Al-Mosawi

Reputation: 1684

I know this is an outdated question but I think someone will benefit from this and also the answer is relevant not outdated.

You need to fix environment: in pubspec.yaml to allow the Dart SDK version you are using (the one from Flutter)

environment:
  sdk: ">=2.0.0-dev.68.0 <3.0.0"

The essential part is <3.0.0

Originally answered here in GitHub by someone called Günter Zöchbauer:- https://github.com/flutter/flutter/issues/21421#issuecomment-418718539

Upvotes: 2

Salar Mohammadi
Salar Mohammadi

Reputation: 81

just update your sdk by these codes

flutter channel dev
flutter upgrade

if you live in iran you need to use proxy because google no let you to use its packages and for scoped_model you need to use below version of it in your pubspec.yaml file

dependencies:
  scoped_model: ^1.0.1

and then save the file, your IDE automatically update the package

Upvotes: 6

Payam Khaninejad
Payam Khaninejad

Reputation: 7996

Just modify the package version in pubspec.yaml to the latest version fixed my issue.

Upvotes: 2

dazza5000
dazza5000

Reputation: 7628

I was having a similar issue:

Running "flutter packages get" in austin-feeds-me-flutter...
The current Dart SDK version is 2.0.0-dev.58.0.flutter-f981f09760.

Because austin_feeds_me depends on palette_generator any which requires SDK version >=2.0.0-dev.61.0 <3.0.0, version solving failed.
pub get failed (1)
Process finished with exit code 1

I fixed it with the following commands:

flutter channel dev
flutter upgrade

Fix source: https://github.com/flutter/flutter/issues/19382

Upvotes: 25

david yang
david yang

Reputation: 331

I found the solution of this question by myself.I add the system environment variable PUB_ALLOW_PRERELEASE_SDK=false,so Just remove this system environment variable, the question will be solved.

Upvotes: 0

Related Questions