Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Q: How to run flutter app on device without usb or connecting to computer

Tags:

flutter

Is it possibly to run flutter app on device without connecting to computer, something like expo for Flutter?

like image 632
Temuujin Dev Avatar asked Jan 10 '20 01:01

Temuujin Dev


3 Answers

assuming that you're using an Android device, it should be possible if you pre-connect the device to the computer wirelessly after some initial setup provided here: https://developer.android.com/studio/command-line/adb#wireless

like image 94
tanyehzheng Avatar answered Oct 31 '22 18:10

tanyehzheng


You can use adb wifi plugin. Or else you can use these commands(Which is mentioned in here). You can write a *.bat file with these commands.

adb tcpip 5555
adb connect xxx.xxx.xxx.xxx:5555 // IP address of your device xxx.xxx.xxx.xxx:5555
echo finished - unplug USB connection
pause

Note: This is only for Android devices

like image 4
Ashan Avatar answered Oct 31 '22 18:10

Ashan


For Android:

  1. Connect your Android device and adb host computer to a common Wi-Fi network accessible to both. Beware that not all access points are suitable; you might need to use an access point whose firewall is configured properly to support adb.
  2. If you are connecting to a Wear OS device, turn off Bluetooth on the phone that's paired with the device.
  3. Connect the device to the host computer with a USB cable.
  4. Set the target device to listen for a TCP/IP connection on port 5555.

    adb tcpip 5555

  5. Disconnect the USB cable from the target device.

  6. Find the IP address of the Android device. For example, on a Nexus device, you can find the IP address at Settings > About tablet (or About phone) > Status > IP address. Or, on a Wear OS device, you can find the IP address at Settings > Wi-Fi Settings > Advanced > IP address.

  7. Connect to the device by its IP address.

    adb connect device_ip_address

  8. Confirm that your host computer is connected to the target device:

    $ adb devices List of devices attached device_ip_address:5555 device You're now good to go!

If the adb connection is ever lost:

  1. Make sure that your host is still connected to the same Wi-Fi network your Android device is.
  2. Reconnect by executing the adb connect step again.
  3. Or if that doesn't work, reset your adb host:

    adb kill-server Then start over from the beginning.

Source of information.

If you don't want to do all these steps manually then you can use this plugin in Android Studio:

https://plugins.jetbrains.com/plugin/7856-adb-wifi/

See also:

https://android.jlelse.eu/connect-android-device-with-wifi-within-android-studio-3b1bc00c1e17

like image 2
Kalpesh Kundanani Avatar answered Oct 31 '22 19:10

Kalpesh Kundanani