tools/testing/dart/main.dart:1: Warning: Interpreting this as package URI, ‘package:test_dart/main.dart’.

When running tools/test.py inside the Dart SDK:

tools/test.py --help

The dart executable prints an error:

tools/testing/dart/main.dart:1: Warning: Interpreting this as package URI, 'package:test_dart/main.dart'.

The tools/test.py wrapper invokes tools/sdks/dart-sdk/bin/dart tools/testing/dart/main.dart. This warning seems to be because .packages contains test_dart:tools/testing/dart and tools/testing/dart/main.dart is inside the test_dart package. The warning is telling us that the package URI was rewritten.

We would like to fix this warning. It doesn’t seem to be possible to invoke the dart script with a package URI:

tools/sdks/dart-sdk/bin/dart package:test_dart/main.dart
Crash when compiling package:test_dart/main.dart,
at character offset null:
FileSystemException(uri=package:test_dart/.packages; message=StandardFileSystem only supports file:* and data:* URIs)

As only file: and data: are supported.

Possible resolutions:

  • We could delete the entry in .packages, however, pkg/testing has three uses of the package. Unclear if we can get refactor ourselves out of that.
  • We could have another entry point outside of the tools/testing/dart directory.
  • Entry points inside the package: scheme could be implemented.
  • The warning could stop being shown in these circumstances.
  • Or something else?

We’re unclear how best to resolve this problem. Front end team, can you advise us please?

Author: Fantashit

2 thoughts on “tools/testing/dart/main.dart:1: Warning: Interpreting this as package URI, ‘package:test_dart/main.dart’.

  1. I got this error from android studio and running my client as normal. (i thought). It turned out I somehow had selected another run-target for main.dart. Guessing pure dart code (dart icon, not flutter). Switched to main.dart with Flutter icon and now it runs again.

  2. I got this error from android studio and running my client as normal. (i thought). It turned out I somehow had selected another run-target for main.dart. Guessing pure dart code (dart icon, not flutter). Switched to main.dart with Flutter icon and now it runs again.

    I can’t understand.

    @NanaGithub, at the top of Android Studio, there is a drop-down menu with targets. It probably says “main.dart”.
    Inside the box, left of the “main.dart”, there is a blue symbol. Either it is an “[ (F) main.dart ]” (the Flutter logo) or it is a Dart-arrow fin logo “[ (X) main.dart ]”. It should be the “F” version to build properly, so select that.

Comments are closed.