Skip to content

[pigeon] StandardFileSystem only supports file:* and data:* URIs #68196

Closed
flutter/packages
#230

Description

@ipipip1735

image

image

E:\Program\AndroidStudio\Flutter\basics>flutter pub run pigeon ^
More? --input pigeons/message.dart ^
More? --dart_out lib/pigeon.dart ^
More? --objc_header_out ios/Runner/pigeon.h ^
More? --objc_source_out ios/Runner/pigeon.m ^
More? --java_out ./android/app/src/main/java/dev/flutter/pigeon/Pigeon.java ^
More? --java_package "mine.pigeon"
Unhandled exception:
IsolateSpawnException: Unable to spawn isolate: /C:/Users/ADMINI~1/AppData/Local/Temp/ee87bb06/_pigeon_temp_.dart:1:8: Error: Error when reading 'e
:ProgramAndroidStudioFlutter%08asicspigeonsmessage.dart': StandardFileSystem only supports file:* and data:* URIs
import 'E:\Program\AndroidStudio\Flutter\basics\pigeons\message.dart';
       ^
pub finished with exit code 255








=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
the code created is incorrect
`import 'E:\Program\AndroidStudio\Flutter\basics\pigeons\message.dart';`

Activity

  1. TahaTesser commented on Oct 15, 2020

    @TahaTesser
    Contributor

    Hi @ipipip1735
    Can you please provide your flutter doctor -v and flutter run --verbose logs, and a minimal complete reproducible code sample?
    Thank you

  2. added
    in triagePresently being triaged by the triage team
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Oct 15, 2020
  3. ipipip1735 commented on Oct 15, 2020

    @ipipip1735
    Author

    flutter doctor -v

    [√] Flutter (Channel stable, 1.20.4, on Microsoft Windows [Version 10.0.18362.1139], locale zh-CN)
        • Flutter version 1.20.4 at D:\SoftWare\Flutter\flutter-1.20.4
        • Framework revision fba99f6cf9 (4 weeks ago), 2020-09-14 15:32:52 -0700
        • Engine revision d1bc06f032
        • Dart version 2.9.2
    
    [!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
        • Android SDK at D:\SoftWare\Android\SDK
        • Platform android-29, build-tools 29.0.3
        • Java binary at: D:\SoftWare\Android\AndroidStudio\jre\bin\java
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
        X Android license status unknown.
          Try re-installing or updating your Android SDK Manager.
          See https://developer.android.com/studio/#downloads or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed
          instructions.
    
    [√] Android Studio (version 4.0)
        • Android Studio at D:\SoftWare\Android\AndroidStudio
        • Flutter plugin version 50.0.1
        • Dart plugin version 193.7547
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    
    [!] Connected device
        ! No devices available
    
    ! Doctor found issues in 2 categories.
    

    image

    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    [code sample]
    pigeons/message.dart

    import 'package:pigeon/pigeon.dart';
    
    class SearchRequest {
      String query;
    }
    
    class SearchReply {
      String result;
    }
    
    @HostApi()
    abstract class Api {
      SearchReply search(SearchRequest request);
    }
    

    [Reproducible Example]
    https://github.com/ipipip1735/one.git

    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    [Error]

    flutter pub run pigeon ^
      --input pigeons/message.dart ^
      --dart_out lib/pigeon.dart ^
      --objc_header_out ios/Runner/pigeon.h ^
      --objc_source_out ios/Runner/pigeon.m ^
      --java_out ./android/app/src/main/java/dev/flutter/pigeon/Pigeon.java ^
      --java_package "dev.flutter.pigeon"
    
    E:\Program\Flutter\one>flutter pub run pigeon ^
    More?   --input pigeons/message.dart ^
    More?   --dart_out lib/pigeon.dart ^
    More?   --objc_header_out ios/Runner/pigeon.h ^
    More?   --objc_source_out ios/Runner/pigeon.m ^
    More?   --java_out ./android/app/src/main/java/dev/flutter/pigeon/Pigeon.java ^
    More?   --java_package "dev.flutter.pigeon"
    Unhandled exception:
    IsolateSpawnException: Unable to spawn isolate: /C:/Users/ADMINI~1/AppData/Local/Temp/5d0452a4/_pigeon_temp_.dart:1:8: Error: Error when reading 'e
    :ProgramFlutteronepigeonsmessage.dart': StandardFileSystem only supports file:* and data:* URIs
    import 'E:\Program\Flutter\one\pigeons\message.dart';
           ^
    pub finished with exit code 255
    

    image

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Oct 15, 2020
  5. TahaTesser commented on Oct 16, 2020

    @TahaTesser
    Contributor

    Hi @ipipip1735
    Looks like you have a special character in your path
    image
    Can you please change your path and try again?
    I am not getting the same error using your code repository

  6. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Oct 16, 2020
  7. ipipip1735 commented on Oct 16, 2020

    @ipipip1735
    Author

    Create flutter plugin
    image

    Declare dart API for platform(Android / iOS) in .dart file

    image

    there is an error using flutter pub run pigeon.
    in windows 10, flutter pub run pigeon creates a .dart file in Windows's temporary directory.
    it seems that import absolute path is incorrect syntax in temp .dart created.

    compiler says StandardFileSystem only supports file:* and data:* URIs

    there is no example using import absolute path in doc

    i try to use / as Path Delimiter, but it doesn't work.
    image

  8. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Oct 16, 2020
  9. ipipip1735 commented on Oct 16, 2020

    @ipipip1735
    Author

    in youtube, i find no video about making API files for android/iOS with pigeon. it seems that pigeon isn't a well-known plugin.

  10. TahaTesser commented on Oct 19, 2020

    @TahaTesser
    Contributor

    Trying on WIndows, I am getting the following error with your project

    C:\Users\Taha\AndroidStudioProjects\one>flutters pub run pigeon ^ --input ./pigeons/message.dart ^ --dart_out lib/pigeon.dart ^ --objc_header_out ios/Runner/pigeon.h ^ --objc_source_out ios/Runner/pigeon.m ^ --
    java_out ./android/app/src/main/java/dev/flutter/pigeon/Pigeon.java ^ --java_package "dev.flutter.pigeon"
    Unhandled exception:
    IsolateSpawnException: Unable to spawn isolate: ../../AppData/Local/Temp/9d5269b2/_pigeon_temp_.dart:1:8: Error: Error when reading '../../AppData/Local/Temp/9d5269b2/........AndroidStudioProjectsonepigeonsmess
    age.dart': The system cannot find the file specified.
    
    import '..\..\..\..\AndroidStudioProjects\one\pigeons\message.dart';
           ^
    pub finished with exit code 255
    

    Same as here #67227 (comment)

    CC @gaaclarke

  11. added
    packageflutter/packages repository. See also p: labels.
    p: pigeonrelated to pigeon messaging codegen tool
    c: crashStack traces logged to the console
    and removed
    in triagePresently being triaged by the triage team
    on Oct 19, 2020
  12. creativecreatorormaybenot commented on Oct 19, 2020

    @creativecreatorormaybenot
    Contributor

    I am wondering if I introduced this 🤔

    I find it strange that the implementation was working for me on Windows when I made #216, however, now I also see this error.

  13. gaaclarke commented on Oct 19, 2020

    @gaaclarke
    Member

    @creativecreatorormaybenot don't worry about it, we need to get Windows CI tests at some point. Not your fault we don't have those yet. I'll get a windows machine setup later today, I'm sure it's something silly.

  14. gaaclarke commented on Oct 19, 2020

    @gaaclarke
    Member

    PR is up for review that fixes this. It turns out that Dart on windows didn't like import statements that use backslashes. I would have expected that to work. It might be that different versions of dart behave differently.

  15. gaaclarke commented on Oct 20, 2020

    @gaaclarke
    Member

    published fix in 0.1.13

  16. ipipip1735 commented on Oct 20, 2020

    @ipipip1735
    Author

    if the same issue still exists when you update the lastest pigeon, also try to the following way.

    1.locate pigeon.dart.
    on windows:
    Your FlutterSDK\.pub-cache\hosted\pub.dartlang.org\pigeon-0.1.13\bin\pigeon.dart

    2.modify pigeon.dart with hard code.
    from:

      final String code = """$importLine
    import 'dart:io';
    import 'dart:isolate';
    import 'package:pigeon/pigeon_lib.dart';
    
    void main(List<String> args, SendPort sendPort) async {
      sendPort.send(await Pigeon.run(args));
    }
    """;
    

    to:

    final String code = """
    import '/E:/Program/AndroidStudio/Flutter/FTA/flutter_plugin_one/pigeons/message.dart';
    import 'dart:io';
    import 'dart:isolate';
    import 'package:pigeon/pigeon_lib.dart';
    
    void main(List<String> args, SendPort sendPort) async {
      sendPort.send(await Pigeon.run(args));
    }
    """;
    

    here, absolute path begins with /. such as:
    import '/E:/Program/AndroidStudio/Flutter/FTA/flutter_plugin_one/pigeons/message.dart';

    1. run flutter clean

    2. re-add dependency in pubspec.yaml, then flutter pub get

    dev_dependencies:
      flutter_test:
        sdk: flutter
      pigeon: ^0.1.13
    
    1. if ios/Runner/ and ./android/app/ doesn't exist in skeleton files, make folders.
      iOS: ios/Runner
      Android: android/src/main/java/dev/flutter/pigeon/

    2. run the following command:

    flutter pub run pigeon \
      --input pigeons/message.dart \
      --dart_out lib/pigeon.dart \
      --objc_header_out ios/Runner/pigeon.h \
      --objc_source_out ios/Runner/pigeon.m \
      --java_out ./android/src/main/java/dev/flutter/pigeon/Pigeon.java \
      --java_package "dev.flutter.pigeon"
    

    updating to 0.1.13 doesn't work for me, so i have to use hard code.
    hope this is helpful to you.

  17. gaaclarke commented on Oct 20, 2020

    @gaaclarke
    Member

    @ipipip1735 I think there were 2 issues, only one got fixed.

    1. Dart doesn't like import statements with backslashes (fixed)
    2. Windows can't do relative paths between drives (not verified, not fixed, I think this is your current issue)

    Can you verify that pigeon works if the input file is on the same drive as your temp directory (probably c:)? We have an issue for that here #68583

  18. github-actions commented on Aug 11, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  19. locked as resolved and limited conversation to collaborators on Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: crashStack traces logged to the consolep: pigeonrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions