When using Atom with the dartlang package, I attempt to use the Dartlang: Run Application command and get the following result:
[/Users/craig/Code/flutter-test/atom1] pub run flutter start
Unable to run on Android.
Unable to run on Android.
Unable to run application - no connected devices.
I get the same thing in the console when running flutter start in the app directory.
My phone is a Nexus 6p that is connected to my computer via USB and has 'USB debugging' enabled in Developer options. How can I get these commands to successfully deploy the app to my device?
Though my device was connected, it was not "authorized". I used the adb devices command to check if it was connected, and the output was something like this:
02:06 PM atom1: adb devices
List of devices attached
8XV5T15A20007972 unauthorized
Note the unauthorized on the last line. After some googling, I learned to go into my phone, and toggle Developer Options > USB debugging from enabled, to disabled, to enabled again. I did this without disconnecting the phone. Re-running adb devices then showed:
02:06 PM atom1: adb devices
List of devices attached
8XV5T15A20007972 device
Note device on the last line instead of unauthorized. I re-ran the Dartlang: Run Application from within Atom and the deploy worked. Somewhere in there, I had to accept the push to device from my phone.
open the device in avd manager and try to run the command again
or you can use your own mobile device just plug your device to your laptop or computer in android you have to enable USB debugging in developer mode setting
or you can build a apk and install it on your device
flutter build
Related
I'm trying to develop my flutter app with a physical (iOS) device plugged in, to access hot reload and hot restart. (via flutter run)
I am able to run the app with my device with flutter run however, I get the logs:
If you do NOT see the Flutter application running, it might have crashed. The device logs (e.g. from adb or XCode) might have more details.
If you do see the Flutter application running on the device, try re-running with --host-vmservice-port to use a specific port known to be available.
This prohibits me from accessing the developer tools in the console.
Is there a way to find the --host-vmservice-port of the physical device?
Found out that this was because my system user didn't have read/write permissions for the /flutter/bin/cache/artifacts/usbmuxd/iproxy file.
Enabled it following this, and now I'm able to successfully debug and hot reload with a physical device ✔️
So i'm testing a flutter app that builds and installs successfully on an iOS simulator as well as a physical devices. However, when building and installing the app with xcode via the USB, it successfully installs and launches but when the USB is disconnected from my mac and i try to run the already installed device on the iPhone, it shows only the launch / splash screen and fades and closes.
Is there something i'm doing wrong that causes this to happen? As the app works fine when connected with the USB and it's being run.
If the build is in debug mode - it won't open.
if you want to open application after disconnecting, try profile / release mode
flutter run --profile
or
flutter run --release
In iOS, debug build doesn't work without USB. To use the app without USB trying making a release build using flutter run --release
I made a flutter app and tried to build on iPhone. It works while debugging is connected. But if I try to exit and relaunch the app or disconnect cable, it would not launch again and keeps crashing.
How can I use the app while Xcode debugging is disconnected?
Run flutter run --release in the terminal and that'll allow you to run a production version app on your iOS device without debugging connected.
If you only Start Debugging after this you can disconnect cable and will work. If you after Restart Debugging after this if you disconnect cable app will be crashing. I think you restart debugging.
From Xcode, you can change the Build Configuration of the Run Schema easily. To do this, click on Runner -> Edit Scheme, then go in the Run tab, choose "Release" in the Build Configuration drop down menu. To install the application, run the configuration again.
See Step 4 in this page for screenshots.
Assuming you can already able to debug with cable.
flutter build ios
connect cable
flutter install , if more than 1 device option is available, terminal will prompt you to choose the device for installation.
now you can disconnect cable
Here's my Environment
Xcode Version: 11.1 (11A1027)
Physical device: - iPad mini 2 (IOS 12.4.2)
VSCode Version: 1.39.2
Flutter version: 1.9.1+hotfix.6
When I use the iOS part of the Flutter project and run it physical device using XCode, it detects the device and works fine but I am somehow not able to see the device on the available devices section on VSCode.
However VSCode detects and works fine with the simulator.
I also ran flutter doctor to see connected devices, but again it does not show the connected physical devices but shows the simulator created device.
Use rm -rf <flutter_repo_directory>/bin/cache to force delete the files in cache and then flutter doctor -v to reinstall the missing sdk directories.
Deleting the cache in flutter/bin/cache directory and then reinstalling the dart sdk solved this issue.
Referred to this issue in Flutter repository(Issue No:41006).
I had the same issue. In my case, a recent iOS update had turned off Developer mode, for some reason... So I needed to enable it again (Settings - Privacy & Security - Developer Mode).
iPadOS / iOS Devices Setup for Hot Reload
Before trying to flutter Debug on physical device from Vscode it is Required to first :
Run a successful Xcode build on that iOS or iPadOS device
Follow this steps if you don't know how to Run Xcode Build -> your device should then be detected by flutter :
Open Xcode & do all the classic Set Up (Signing in with a Team & choosing a UNIQUE bundle Identifier)
Set Your iPhone Auto-Lock to Never (& Unlock it !) - Connect your iPhone or iPad to Mac with USB cable & Accept Prompt on the iPhone
Run Xcode Build on your iPhone this alert prompt will select Ok
On your iPhone a new menu will have appeared - Navigate to it & Click « Verify App » or « Accept »
Now Run Xcode Build Again - if does not run try running flutter clean & flutter build ios & try running again
—
After Successful Xcode Build - Stop Running the App
Keep Xcode Open
— iOS Setup is done
Close all Simulators or Emulators - Close VsCode
run flutter devices to make sure your Device is now detected
if it’s not try Turning it off & plugging it back again - remember to accept Trust Computer Prompt - keep it device unlocked too !
Open back your project in VsCode or Android Studio
Hot Reload⚡️Using VsCode :
Press F8 or Select ▷ « Start Debugging » in main.dart
That’s it ! You now have the power of Hot Reload⚡️ with VsCode on a physical device !
Hot Reload using Terminal Commands :
run flutter run -d yourDeviceID
Have fun ! Press r in Terminal for HotReload⚡️
If you need to find your iOS device ID :
Select Add Additional Simulators
Hot Reload⚡️on Android Studio :
Select your device & run
All I had to do was to disconnect the device from the laptop, make sure VS Code is open, then connect the device again while no VS Code, then it detected right away and chose the device automatically.
Sometimes it doesn't detect the device if it is not directly connected to the computer. I had a docking station in between and it didn't recognized the device. Especially after you have updated you macOS just before.
With "focus mode" activated on the device (like "do not disturb" 🌙) it won't show up.
Check whether you have fully installed xcode by running flutter doctor -v
Incase you find that some thing like
[!] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
just run install Xcode and run
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
Incase you installed xcode already, just run the above commands, they will do the magic.
After a hard reset (holding power+home) I would like to be able to see the iOS System logs after the phone boots. Using Xcode I can open the "Devices" tool, but unless I unlock the phone I cannot attach to the device to see the logs.
Is there a way to see the iPhone device logs while the phone is booting? Either in real-time or as a log file that I can examine afterwards.
I have also tried using the "View device logs" button in the Devices Tool, but all that I can see in there are crash logs.
Yes, it is possible, there are few options out there, one of my favorites is idevicesyslog, do the following:
Install brew on your mac:
http://coolestguidesontheplanet.com/installing-homebrew-os-x-yosemite-10-10-package-manager-unix-apps/
Using brew, install libimobiledevice
brew install libimobiledevice
Once done, connect idevice to mac and type in terminal
idevicesyslog
Note: if there is more than 1 device connected to the mac, you will need to specify the device udid you wish to work with. In order to get the device udid, run the following command:
idevice_id -l
Then run idevicesyslog, but this time specify the udid:
idevicesyslog -u <device udid>