Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test my Flutter app on my phone? With vscode

Good Morning,

I am having a problem testing my Flutter applications for lack of memory. My computer only has 4GB of RAM and I can't open the emulator for lack of memory, can anyone help me how can I test the app right on my mobile phone?

like image 920
drigols Avatar asked Dec 17 '19 13:12

drigols


People also ask

How can I use my phone as an emulator in Visual Studio code?

Step 1: Go to the Extensions button on VSCode and search for Android and iOS Emulator and install it. Note: Change the Emulator path windows address based on the location of the emulator file on your PC but make the Emulator path as default it would be given as default by the VSCode.


1 Answers

You may need to configure Android toolchain (Step 6 to 12).

  1. Install VSCode.
  2. Install VSCode plugins flutter and dart.
  3. Close VSCode.
  4. Download Flutter SDK.
  5. Unzip and Update environment path variable with "...\FlutterSDK\bin".
  6. Download sdk-tools.
  7. Create an folder anywhere with name "AndroidSDK" (or any other name)
  8. Extract downloaded sdk-tools to AndroidSDK"
  9. Open command prompt at "...\AndroidSDK\tools\bin"
  10. Install platform-tools using the following command sdkmanager platform-tools
  11. Install corresponding platform and build-tools for your mobile device.

    Example: If your device is Android 9 (Which is Android Pie and API level is 28), then commands are

    1. sdkmanager platforms;android-28 (Use sdkmanager --list to see all packages available).
    2. sdkmanager build-tools;28.0.3 (Use sdkmanager --list to see all packages available).
  12. Update Environtment path variable with "...\AndroidSDK\platform-tools"

  13. Now Open New Command prompt
  14. Run Flutter doctor -v to check for any issues (You may have to accept android-licences).

    flutter doctor --android-licenses

  15. Now Open VSCode
  16. Create Flutter project (Ctrl+Shift+p then type "Flutter: New Project")
    Note*: Internet connection is required (or)
    Open Existing Flutter Project folder
  17. Connect your android device (Debugging mode should be enabled in the developer options)
  18. You can see connected device in VSCode at bottom-right corner
  19. Press F5 to run or use "Flutter run" command
like image 104
Crazy Lazy Cat Avatar answered Nov 15 '22 10:11

Crazy Lazy Cat