I want to run/test (not automated test) my Flutter app on a real iPhone and Android phone during development. However, Flutter docs seem to only document how to do it with the iOS simulator or Android emulators.
I think it's already a no-brainer for iOS/Android devs but I am neither and Flutter is my first foray into mobile development.
Is there any link to a beginner's guide somewhere on how to develop while running it on a real device (with all of Flutter's live-reload goodness)?
Additional context
For Android, this is pretty easy:
For iOS this is a little more complicated because you need an Apple ID or to sign up for a " Developer Account ":
(in subsequent runs, you can deploy to the iOS device with Android Studio, VS Code, or any other IDE of choice, you just need to set up that certificate the first time with Xcode. Here's Apple's documentation on setting up Xcode to run a physical device.)
Also you can use your device wirelessly using scrcpy.
Visit this link and install scrcpy. https://github.com/Genymobile/scrcpy
After you install and path scrcpy on your PC/Laptop.
Make sure your phone is connected to your PC/Laptop.
Enable Developers Options and Connect your device to the WIFI.
Open CMD.
Input "adb tcpip 5555". The adb should be restarted
Next, input "adb connect ipaddressofyourdevice:5555" Ex: adb connect 192.168.254.19:5555
Now, you can use your device wirelessly.
Deploy to iOS devices
To deploy your Flutter app to a physical iOS device, you'll need some additional tools and an Apple account. You'll also need to set up physical device deployment in Xcode.
Install homebrew .
Open the terminal and run these commands to install the tools for deploying Flutter apps to iOS devices.
$ brew update $ brew install --HEAD libimobiledevice $ brew install ideviceinstaller ios-deploy cocoapods $ pod setup
If any of these commands fails with an error, run brew doctor and follow the instructions for resolving the issue.
Follow the Xcode signing flow to provision your project: Open the default Xcode workspace in your project by running open ios/Runner.xcworkspace
in a terminal window from your Flutter project directory.
In Xcode, select the Runner project in the left navigation panel.
In the Runner target settings page, make sure your Development Team is selected under General > Signing > Team
. When you select a team, Xcode creates and downloads a Development Certificate, registers your device with your account, and creates and downloads a provisioning profile (if needed).
Development and testing is supported for any Apple ID. Enrolling in the Apple Developer Program is required to distribute your app to the App Store. To create an Apple ID, follow the instructions on the Apple help page .
Then, go to the Settings app on the iOS device, select General > Device Management
and trust your Certificate.
If automatic signing fails in Xcode, verify that the project's General > Identity > Bundle Identifier
value is unique.
Start your app by running flutter run
For more info: https://kobiton.com/topics/develop-deploy-and-test-flutter-apps/
您将在此链接后找到在真实物理iOS 设备上运行 Flutter 应用程序的完整故障排除指南- 带热重载⚡️ - 适用于 M1 和 Intel Macs
Attach your real device on your development PC. To check setup process, run flutter doctor command. If result success of all required criteria then hit
flutter run
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.