Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build_runner build failed #692

Closed
spermicide opened this issue Aug 19, 2020 · 8 comments
Closed

build_runner build failed #692

spermicide opened this issue Aug 19, 2020 · 8 comments

Comments

@spermicide
Copy link

use your official example on this page:
https://pub.dev/packages/json_serializable

when I run
flutter packages pub run build_runner build

it says:

Precompiling executable...
Precompiled build_runner:build_runner.
[INFO] Generating build script...
[INFO] Generating build script completed, took 252ms

[WARNING] Deleted previous snapshot due to missing asset graph.
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 8.0s

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 402ms

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms

[INFO] Running build...
[INFO] Generating SDK summary...
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[INFO] 1.4s elapsed, 1/5 actions completed.
[INFO] 2.5s elapsed, 1/5 actions completed.
[INFO] 3.6s elapsed, 1/5 actions completed.
[INFO] 4.7s elapsed, 1/5 actions completed.
[INFO] 5.8s elapsed, 1/5 actions completed.
[INFO] 6.9s elapsed, 1/5 actions completed.
[INFO] 8.0s elapsed, 1/5 actions completed.
[INFO] 9.1s elapsed, 1/5 actions completed.
[INFO] 10.2s elapsed, 1/5 actions completed.
[INFO] 11.3s elapsed, 1/5 actions completed.
[INFO] 12.4s elapsed, 1/5 actions completed.
[INFO] 13.5s elapsed, 1/5 actions completed.

and nothing generated

this is my version


dev_dependencies:

  build_runner: ^1.0.0
  json_serializable: ^3.4.0

dependencies:

  json_annotation: ^3.0.0

Flutter 1.20.2 

Tools • Dart 2.9.1

Hope you to tell me how can I do
thanks!

@DurianWyn
Copy link

use your official example on this page:
https://pub.dev/packages/json_serializable

when I run
flutter packages pub run build_runner build

it says:

Precompiling executable...
Precompiled build_runner:build_runner.
[INFO] Generating build script...
[INFO] Generating build script completed, took 252ms

[WARNING] Deleted previous snapshot due to missing asset graph.
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 8.0s

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 402ms

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms

[INFO] Running build...
[INFO] Generating SDK summary...
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[INFO] 1.4s elapsed, 1/5 actions completed.
[INFO] 2.5s elapsed, 1/5 actions completed.
[INFO] 3.6s elapsed, 1/5 actions completed.
[INFO] 4.7s elapsed, 1/5 actions completed.
[INFO] 5.8s elapsed, 1/5 actions completed.
[INFO] 6.9s elapsed, 1/5 actions completed.
[INFO] 8.0s elapsed, 1/5 actions completed.
[INFO] 9.1s elapsed, 1/5 actions completed.
[INFO] 10.2s elapsed, 1/5 actions completed.
[INFO] 11.3s elapsed, 1/5 actions completed.
[INFO] 12.4s elapsed, 1/5 actions completed.
[INFO] 13.5s elapsed, 1/5 actions completed.

and nothing generated

this is my version


dev_dependencies:

  build_runner: ^1.0.0
  json_serializable: ^3.4.0

dependencies:

  json_annotation: ^3.0.0

Flutter 1.20.2 

Tools • Dart 2.9.1

Hope you to tell me how can I do
thanks!

I also encountered the same problem, so I switched from flutter 1.20.2 to 1.17.5, and it worked normally on 1.17.5

@pomegra
Copy link

pomegra commented Aug 20, 2020

use your official example on this page:
https://pub.dev/packages/json_serializable

when I run
flutter packages pub run build_runner build

it says:

Precompiling executable...
Precompiled build_runner:build_runner.
[INFO] Generating build script...
[INFO] Generating build script completed, took 252ms

[WARNING] Deleted previous snapshot due to missing asset graph.
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 8.0s

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 402ms

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms

[INFO] Running build...
[INFO] Generating SDK summary...
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[INFO] 1.4s elapsed, 1/5 actions completed.
[INFO] 2.5s elapsed, 1/5 actions completed.
[INFO] 3.6s elapsed, 1/5 actions completed.
[INFO] 4.7s elapsed, 1/5 actions completed.
[INFO] 5.8s elapsed, 1/5 actions completed.
[INFO] 6.9s elapsed, 1/5 actions completed.
[INFO] 8.0s elapsed, 1/5 actions completed.
[INFO] 9.1s elapsed, 1/5 actions completed.
[INFO] 10.2s elapsed, 1/5 actions completed.
[INFO] 11.3s elapsed, 1/5 actions completed.
[INFO] 12.4s elapsed, 1/5 actions completed.
[INFO] 13.5s elapsed, 1/5 actions completed.
and nothing generated

this is my version

dev_dependencies:

build_runner: ^1.0.0
json_serializable: ^3.4.0

dependencies:

json_annotation: ^3.0.0

Flutter 1.20.2

Tools • Dart 2.9.1
Hope you to tell me how can I do
thanks!

@DurianWyn
Copy link

use your official example on this page:
https://pub.dev/packages/json_serializable

when I run
flutter packages pub run build_runner build

it says:

Precompiling executable...
Precompiled build_runner:build_runner.
[INFO] Generating build script...
[INFO] Generating build script completed, took 252ms

[WARNING] Deleted previous snapshot due to missing asset graph.
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 8.0s

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 402ms

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms

[INFO] Running build...
[INFO] Generating SDK summary...
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[SEVERE] json_serializable:json_serializable on lib/example.dart:

Bad state: Unexpected diagnostics:
F:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[INFO] 1.4s elapsed, 1/5 actions completed.
[INFO] 2.5s elapsed, 1/5 actions completed.
[INFO] 3.6s elapsed, 1/5 actions completed.
[INFO] 4.7s elapsed, 1/5 actions completed.
[INFO] 5.8s elapsed, 1/5 actions completed.
[INFO] 6.9s elapsed, 1/5 actions completed.
[INFO] 8.0s elapsed, 1/5 actions completed.
[INFO] 9.1s elapsed, 1/5 actions completed.
[INFO] 10.2s elapsed, 1/5 actions completed.
[INFO] 11.3s elapsed, 1/5 actions completed.
[INFO] 12.4s elapsed, 1/5 actions completed.
[INFO] 13.5s elapsed, 1/5 actions completed.
and nothing generated

this is my version

dev_dependencies:

build_runner: ^1.0.0
json_serializable: ^3.4.0

dependencies:

json_annotation: ^3.0.0

Flutter 1.20.2

Tools • Dart 2.9.1
Hope you to tell me how can I do
thanks!

I manually downgraded the flutter version, you can execute "flutter version + version number" to downgrade to the version you want to use

@poshpawstudio
Copy link

poshpawstudio commented Aug 23, 2020

This issue is blocking me from upgrading Flutter version to 1.20.

@jakemac53
Copy link
Collaborator

What version of analyzer do you have? You can run pub deps to see this or check your pubspec.lock file.

@jakemac53
Copy link
Collaborator

Looking into this one possible solution is set your build_runner version to ^1.10.1. That should work but is a roundabout fix.

I am trying to figure out the real issue here, the sdk seems to be using invalid syntax ?.[ which maybe was allowed for a period of time or something I am not sure (now you just do ?[).

@jakemac53
Copy link
Collaborator

Just to follow up here this was definitely the problem, see the related sdk issue about the syntax change dart-lang/language#376.

Since then the support for ?.[ has been removed but the min sdk for that analyzer version was not set to not include sdks that use that syntax, hence the error.

You need to ensure you get an older analyzer version in order to successfully analyze this sdk, although I am not totally sure exactly what version you need I know that 0.39.14 works.

@kevmoo
Copy link
Collaborator

kevmoo commented Aug 24, 2020

Closing this out as it's not specific to json_serializable – although it IS annoying!

@kevmoo kevmoo closed this as completed Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants