Reputation: 767
In my flutter project when I run either :
./gradlew build
or
gradle build
I get this type of error :
.dart_tool/flutter_build/generated_main.dart:11:8: Error: Error when reading 'lib/main.dart': Le fichier sp├®cifi├® est introuvable.
This is because my main.dart is located in "lib/src/main" instead of "lib" , and it needs to stays that way.
When I run my build with flutter I use an option to specify the main location :
flutter build apk -t "lib/src/main/main.dart"
And it works fine.
Is there such option for./gradlew build or gradle build ?
Thanks.
Upvotes: 1
Views: 1154
Reputation: 103
Here's the answer...
./gradlew build -Ptarget=lib/entry_point_name.dart
The -P indicates gradle that what follows is a project parameter, in this case the parameter's name is 'target'. This parameter is used to override the default main.dart entry point.
Upvotes: 2
Reputation: 1670
If you are using android studio then follow these steps:
Thats it.
Upvotes: 0