简体   繁体   中英

Getting error like “Target file ”lib\main.dart“ not found.” whlie building APK in flutter

When i do Build -> Flutter -> Build APK in android studio for flutter application, i get the error like "Target file "lib\main.dart" not found.", although i'm able to run application because i have changed the test/widget_test.dart file.

I have changed the main file to routes.dart file which is in the lib folder, so how to solve this error?

在此处输入图像描述

Thanks in advance.

When i run command "flutter build apk --target=lib/routes.dart", I get error like this:

在此处输入图像描述

The default entry point is main.dart Since there is no main.dart file in your /lib directory you have to specify the entry point. Run the command to build with target option:

flutter build apk --target=lib/routes.dart

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM