简体   繁体   中英

How to run flutter app on android mobile from VS Code on Linux?

I have configured flutter on my Linux Mint and I have downloaded the android command line tools instead of Android Studio. I have also updated the gradle and commandline-tools path on my Linux Mint. Now I want to install the app on my android smartphone and test. How can I do that?

You can type this in your terminal in your project directory to get the release apk for your project

 flutter build apk --release

The release apk file will be in build>app>outputs>flutter-apk>app-release.apk

If you want to debug the app, then you can connect your android phone to your pc and then run this command in the terminal:

flutter run

and then select your android device from the options to debug your app

  1. Run Flutter doctor -v to check for any issues (You may have to accept android-licences with flutter doctor --android-licenses ).

  2. Connect your android device (Debugging mode should be enabled in the developer options) with USB

  3. You can see connected device in VSCode at bottom-right corner,select your device

  4. Press F5 to run or use " Flutter run " command

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