Skip to content

[SOLVED] Building kernel snapshot for release mode works only without -Ddart.vm.product=true #196

Closed
@baldax95

Description

@baldax95

Hi,

I'm following the guide in the section:

[ Building the app.so (for running your app in Release/Profile mode) ]

I'm on Windows 10 and when i run the first command:

dart C:\Users\david\flutter\bin\cache\dart-sdk\bin\snapshots\frontend_server.dart.snapshot --sdk-root C:\Users\david\flutter\bin\cache\artifacts\engine\common\flutter_patched_sdk_product\ --target=flutter --aot --tfa -Ddart.vm.product=true --packages .packages --output-dill build\kernel_snapshot.dill --verbose --depfile build\kernel_snapshot.d package:tower_display/main.dart)

I receive 2 errors:

Error when reading '.vm.product=true': Impossible to find the specified file

Error: No 'main' method found.
Try adding a method named 'main' to your program.

After a few tries I omitted the option -Ddart.vm.product=true and it worked without errors.
The rest of the guide worked fine and I managed to build the app.so file and run the app in release mode.

The problem is that in my code I use the kReleaseMode constant, and without that option it doesn't work.

I can't explain why that option doesn't work, any help is much appreciated, thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions