Flutter IOS debug build installs the app on a real device but fails to initialize dart VM server within 30 seconds and fails to run the app with error message :
Launching lib/main.dart on User's iPad in debug mode...
main.dart:1
Automatically signing iOS for device deployment using specified development team in Xcode project: FQ********
Xcode build done. 25.7s
The Dart VM Service was not discovered after 30 seconds. This is taking much longer than expected...
(lldb) process interrupt
error: Failed to halt process: Halt timed out. State = running
Error launching application on User's iPad.
Exited
But when I try to install on the device with XCode or with simulator, it builds and works fine. I tried solutions on the the link on stackoverflow with different issue, but none of them have no avail to fix the problem.
I have tried with IPad pro 11 inch 2020 and IPhone 11 pro with the same WIFI network. And I am using Macbook M1 pro 14 inch 2021 base model. I've been using real IOS devices for more than a year with the same project. But about a month ago it started giving me the error.
When I try to build with a real device, the app doesn't ask local network permission nor notification permission. I've tried with different projects and it had the same error. Also I created a new flutter project with 0 dependencies, it gave me the same error but after I ran the app with XCode for two times it started working. But after I added dependencies from the first project that I ran into problem with, I started getting the same error. But the weird thing is when I use Flutter release mode, it works fine with any project. (By the way I have enabled wireless debug on XCode with both of the real devices I have mentioned earlier. But no difference with debug builds.)
XCode version : Version 14.3 (14E222b)
Podfile :
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
# config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
'PERMISSION_LOCATION=1',
## dart: PermissionGroup.photos
'PERMISSION_PHOTOS=1',
## dart: PermissionGroup.camera
'PERMISSION_CAMERA=1',
]
end
end
end
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
Flutter doctor verbose :
[✓] Flutter (Channel stable, 3.10.1, on macOS 13.3.1 22E772610a darwin-arm64, locale en-MN)
• Flutter version 3.10.1 on channel stable at /Users/gantushig/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision d3d8effc68 (9 days ago), 2023-05-16 17:59:05 -0700
• Engine revision b4fb11214d
• Dart version 3.0.1
• DevTools version 2.23.1
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
• Android SDK at /Users/gantushig/Library/Android/sdk
• Platform android-33, build-tools 33.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E222b
• CocoaPods version 1.12.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
[✓] VS Code (version 1.78.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.64.0
[✓] Connected device (3 available)
• Gantushig’s iPad (mobile) • 00008027-000C684A0A08402E • ios • iOS 16.4.1 20E252
• macOS (desktop) • macos • darwin-arm64 • macOS 13.3.1 22E772610a darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 113.0.5672.126
[✓] Network resources
• All expected network resources are available.
• No issues found!
Flutter run verbose last few lines :
[ +52 ms] [ 95%] GeneratingApplicationMap
[ +327 ms] [100%] InstallComplete
[ +987 ms] [100%] Installed package build/ios/iphoneos/Runner.app
[ +99 ms] ------ Debug phase ------
[ ] Starting debug of 00008027-000C684A0A08402E (J418AP, iPad Pro 2G (11" Cell), iphoneos, arm64e, 16.4.1, 20E252) a.k.a. 'Gantushig’s iPad' connected
through USB...
[+1026 ms] [ 0%] Looking up developer disk image
[ +27 ms] [ 95%] Developer disk image mounted successfully
[ +23 ms] Symbol Path: /Users/gantushig/Library/Developer/Xcode/iOS DeviceSupport/16.4.1 (20E252) arm64e/Symbols
[ +457 ms] [100%] Connecting to remote debug server
[ ] -------------------------
[ +99 ms] (lldb) command source -s 0 '/tmp/B9863F2D-673A-40A5-9D48-5C384D397A22/fruitstrap-lldb-prep-cmds-00008027_000C684A0A08402E'
[ ] Executing commands in '/tmp/B9863F2D-673A-40A5-9D48-5C384D397A22/fruitstrap-lldb-prep-cmds-00008027_000C684A0A08402E'.
[ ] (lldb) platform select remote-'ios' --sysroot '/Users/gantushig/Library/Developer/Xcode/iOS DeviceSupport/16.4.1 (20E252) arm64e/Symbols'
[ ] Platform: remote-ios
[ ] Connected: no
[ ] Sysroot: /Users/gantushig/Library/Developer/Xcode/iOS DeviceSupport/16.4.1 (20E252) arm64e/Symbols
[ ] SDK Path: "/Users/gantushig/Library/Developer/Xcode/iOS DeviceSupport/16.4.1 (20E252) arm64e/Symbols"
[ ] (lldb) target create "/Users/gantushig/projects/soyohon/soyohon_mobile/build/ios/iphoneos/Runner.app"
[+6149 ms] Current executable set to '/Users/gantushig/projects/soyohon/soyohon_mobile/build/ios/iphoneos/Runner.app' (arm64).
[ ] (lldb) script fruitstrap_device_app="/private/var/containers/Bundle/Application/9191066D-06EC-41D9-A945-7BBDAB5CEBA1/Runner.app"
[ ] (lldb) script fruitstrap_connect_url="connect://127.0.0.1:59678"
[ ] (lldb) script fruitstrap_output_path=""
[ ] (lldb) script fruitstrap_error_path=""
[ ] (lldb) target modules search-paths add /usr "/Users/gantushig/Library/Developer/Xcode/iOS DeviceSupport/16.4.1 (20E252) arm64e/Symbols/usr"
/System "/Users/gantushig/Library/Developer/Xcode/iOS DeviceSupport/16.4.1 (20E252) arm64e/Symbols/System"
"/private/var/containers/Bundle/Application/9191066D-06EC-41D9-A945-7BBDAB5CEBA1" "/Users/gantushig/projects/soyohon/soyohon_mobile/build/ios/iphoneos"
"/var/containers/Bundle/Application/9191066D-06EC-41D9-A945-7BBDAB5CEBA1" "/Users/gantushig/projects/soyohon/soyohon_mobile/build/ios/iphoneos" /Developer
"/Users/gantushig/Library/Developer/Xcode/iOS DeviceSupport/16.4.1 (20E252) arm64e/Symbols/Developer"
[ +34 ms] (lldb) command script import "/tmp/B9863F2D-673A-40A5-9D48-5C384D397A22/fruitstrap_00008027_000C684A0A08402E.py"
[ +3 ms] (lldb) command script add -f fruitstrap_00008027_000C684A0A08402E.connect_command connect
[ ] (lldb) command script add -s asynchronous -f fruitstrap_00008027_000C684A0A08402E.run_command run
[ ] (lldb) command script add -s asynchronous -f fruitstrap_00008027_000C684A0A08402E.autoexit_command autoexit
[ ] (lldb) command script add -s asynchronous -f fruitstrap_00008027_000C684A0A08402E.safequit_command safequit
[ ] (lldb) connect
[ +32 ms] (lldb) run
[ +198 ms] success
[ ] Application launched on the device. Waiting for Dart VM Service url.
[+30005 ms] The Dart VM Service was not discovered after 30 seconds. This is taking much longer than expected...
[ +8 ms] (lldb) process interrupt
[ ] error: Failed to halt process: Halt timed out. State = running
[+2073 ms] (lldb) Process 2598 exited with status = -1 (0xffffffff) lost connection
[ +3 ms] ios-deploy exited with code 0
[ +6 ms] Installing and launching... (completed in 56.6s)
[ ] Error launching application on Gantushig’s iPad.
[ +2 ms] "flutter run" took 96,019ms.
[ +3 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:757:9)
<asynchronous suspension>
#2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1336:27)
<asynchronous suspension>
#3 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#4 CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#5 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:296:9)
<asynchronous suspension>
#6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:244:5)
<asynchronous suspension>
#8 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:91:9)
<asynchronous suspension>
#9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#10 main (package:flutter_tools/executable.dart:91:3)
<asynchronous suspension>
[ +259 ms] ensureAnalyticsSent: 253ms
[ ] Running 1 shutdown hook
[ +3 ms] Shutdown hooks complete
[ ] exiting with code 1
Flutter pubspec yaml file :
name: flutter_app
description: Social app.
publish_to: 'none'
version: 1.0.0+36
environment:
sdk: '>=3.0.1 <4.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
dio: ^5.0.0
rive: ^0.11.1
provider: ^6.0.2
cookie_jar: ^4.0.2
dio_cookie_manager: ^3.0.0
path_provider: ^2.0.8
flutter_form_builder: ^9.0.0-dev.3
form_builder_validators: ^9.0.0-dev.2
fluttertoast: ^8.0.9
flutter_svg: ^2.0.0+1
get_it: ^7.2.0
another_flushbar: ^1.10.28
flutter_native_splash: ^2.2.9
image_picker: ^0.8.3
image_cropper: ^3.0.0
pinput: ^2.2.7
firebase_core: ^2.4.1
firebase_messaging: ^14.2.1
flutter_local_notifications: ^14.0.0+1
socket_io_client: ^2.0.1
location: ^4.4.0
avatar_glow: ^2.0.2
device_info_plus: ^9.0.0
carousel_slider: ^4.1.1
skeletons: ^0.0.3
hive: ^2.2.3
hive_flutter: ^1.1.0
qr_flutter: ^4.0.0
url_launcher: ^6.1.6
android_intent_plus: ^4.0.0
device_apps: ^2.2.0
cached_network_image: ^3.2.2
external_app_launcher: ^3.1.0
permission_handler: ^10.2.0
flutter_cache_manager: ^3.3.0
water_drop_nav_bar: ^2.2.0+5
connectivity_plus: ^4.0.0
font_awesome_flutter: ^10.3.0
intl: ^0.18.0
freezed_annotation: ^2.2.0
json_annotation: ^4.8.0
collection: ^1.17.0
webview_flutter: ^4.2.0
webview_flutter_android: ^3.7.0
webview_flutter_wkwebview: ^3.4.3
flutter_native_splash:
image: assets/images/logo.png
color: '#FA4251'
android_12:
image: assets/images/android_splash_icon.png
icon_background_color: '#FA4251'
image_dark: assets/images/android_splash_icon.png
icon_background_color_dark: '#FA4251'
dev_dependencies:
flutter_test:
sdk: flutter
freezed: ^2.3.2
flutter_lints: ^2.0.0
hive_generator: ^2.0.0
build_runner: ^2.3.3
json_serializable: ^6.6.1
flutter:
uses-material-design: true
assets:
- assets/rive_models/simple-loader.riv
- assets/rive_models/find_user.riv
- assets/rive_models/new_file.riv
- assets/rive_models/spaceship_pull_refresh.riv
- assets/rive_models/
- assets/images/christmas_logo.png
- assets/images/astrology/
- assets/images/svg/back.svg
- assets/images/svg/icons/shopping-bag.svg
- assets/images/svg/
- assets/images/back_image/
- assets/images/logo.png
- assets/images/membership/
- assets/images/android_splash_icon.png
- assets/images/mission/icons/
- assets/images/mission/
- assets/images/
- assets/gif/
fonts:
- family: Rubik
fonts:
- asset: assets/fonts/Rubik/Rubik-Light.ttf
style: normal
weight: 300
- asset: assets/fonts/Rubik/Rubik-LightItalic.ttf
style: italic
weight: 300
- asset: assets/fonts/Rubik/Rubik-Regular.ttf
style: normal
weight: 400
- asset: assets/fonts/Rubik/Rubik-Italic.ttf
style: italic
weight: 400
- asset: assets/fonts/Rubik/Rubik-Medium.ttf
style: normal
weight: 500
- asset: assets/fonts/Rubik/Rubik-MediumItalic.ttf
style: italic
weight: 500
- asset: assets/fonts/Rubik/Rubik-SemiBold.ttf
style: normal
weight: 600
- asset: assets/fonts/Rubik/Rubik-SemiBoldItalic.ttf
style: italic
weight: 600
- asset: assets/fonts/Rubik/Rubik-Bold.ttf
style: normal
weight: 700
- asset: assets/fonts/Rubik/Rubik-BoldItalic.ttf
style: italic
weight: 700
- asset: assets/fonts/Rubik/Rubik-ExtraBold.ttf
style: normal
weight: 800
- asset: assets/fonts/Rubik/Rubik-ExtraBoldItalic.ttf
style: italic
weight: 800
- asset: assets/fonts/Rubik/Rubik-Black.ttf
style: normal
weight: 900
- asset: assets/fonts/Rubik/Rubik-BlackItalic.ttf
style: italic
weight: 900
- family: Roboto
fonts:
- asset: assets/fonts/Roboto/Roboto-Thin.ttf
style: normal
weight: 100
- asset: assets/fonts/Roboto/Roboto-ThinItalic.ttf
style: italic
weight: 100
- asset: assets/fonts/Roboto/Roboto-Light.ttf
style: normal
weight: 300
- asset: assets/fonts/Roboto/Roboto-LightItalic.ttf
style: italic
weight: 300
- asset: assets/fonts/Roboto/Roboto-Regular.ttf
style: normal
weight: 400
- asset: assets/fonts/Roboto/Roboto-Italic.ttf
style: italic
weight: 400
- asset: assets/fonts/Roboto/Roboto-Medium.ttf
style: normal
weight: 500
- asset: assets/fonts/Roboto/Roboto-MediumItalic.ttf
style: italic
weight: 500
- asset: assets/fonts/Roboto/Roboto-Bold.ttf
style: normal
weight: 700
- asset: assets/fonts/Roboto/Roboto-BoldItalic.ttf
style: italic
weight: 700
- asset: assets/fonts/Roboto/Roboto-Black.ttf
style: normal
weight: 900
- asset: assets/fonts/Roboto/Roboto-BlackItalic.ttf
style: italic
weight: 900
- family: Poppins
fonts:
- asset: assets/fonts/Poppins/Poppins-Thin.ttf
style: normal
weight: 100
- asset: assets/fonts/Poppins/Poppins-ThinItalic.ttf
style: italic
weight: 100
- asset: assets/fonts/Poppins/Poppins-ExtraLight.ttf
style: normal
weight: 200
- asset: assets/fonts/Poppins/Poppins-ExtraLightItalic.ttf
style: italic
weight: 200
- asset: assets/fonts/Poppins/Poppins-Light.ttf
style: normal
weight: 300
- asset: assets/fonts/Poppins/Poppins-LightItalic.ttf
style: italic
weight: 300
- asset: assets/fonts/Poppins/Poppins-Regular.ttf
style: normal
weight: 400
- asset: assets/fonts/Poppins/Poppins-Italic.ttf
style: italic
weight: 400
- asset: assets/fonts/Poppins/Poppins-Medium.ttf
style: normal
weight: 500
- asset: assets/fonts/Poppins/Poppins-MediumItalic.ttf
style: italic
weight: 500
- asset: assets/fonts/Poppins/Poppins-SemiBold.ttf
style: normal
weight: 600
- asset: assets/fonts/Poppins/Poppins-SemiBoldItalic.ttf
style: italic
weight: 600
- asset: assets/fonts/Poppins/Poppins-Bold.ttf
style: normal
weight: 700
- asset: assets/fonts/Poppins/Poppins-BoldItalic.ttf
style: italic
weight: 700
- asset: assets/fonts/Poppins/Poppins-ExtraBold.ttf
style: normal
weight: 800
- asset: assets/fonts/Poppins/Poppins-ExtraBoldItalic.ttf
style: italic
weight: 800
- asset: assets/fonts/Poppins/Poppins-Black.ttf
style: normal
weight: 900
- asset: assets/fonts/Poppins/Poppins-Black.ttf
style: italic
weight: 900
- family: Inter
fonts:
- asset: assets/fonts/Inter/Inter-Thin.ttf
style: normal
weight: 100
- asset: assets/fonts/Inter/Inter-ExtraLight.ttf
style: normal
weight: 200
- asset: assets/fonts/Inter/Inter-Light.ttf
style: normal
weight: 300
- asset: assets/fonts/Inter/Inter-Regular.ttf
style: normal
weight: 400
- asset: assets/fonts/Inter/Inter-Medium.ttf
style: normal
weight: 500
- asset: assets/fonts/Inter/Inter-SemiBold.ttf
style: normal
weight: 600
- asset: assets/fonts/Inter/Inter-Bold.ttf
style: normal
weight: 700
- asset: assets/fonts/Inter/Inter-ExtraBold.ttf
style: normal
weight: 800
- asset: assets/fonts/Inter/Inter-Black.ttf
style: normal
weight: 900
- family: Source Sans Pro
fonts:
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-ExtraLight.ttf
style: normal
weight: 200
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-ExtraLightItalic.ttf
style: italic
weight: 200
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-Light.ttf
style: normal
weight: 300
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-LightItalic.ttf
style: italic
weight: 300
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-Regular.ttf
style: normal
weight: 400
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-Italic.ttf
style: italic
weight: 400
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-SemiBold.ttf
style: normal
weight: 600
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-SemiBoldItalic.ttf
style: italic
weight: 600
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-Bold.ttf
style: normal
weight: 700
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-BoldItalic.ttf
style: italic
weight: 700
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-Black.ttf
style: normal
weight: 900
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-BlackItalic.ttf
style: italic
weight: 900
It should work fine. And I really need to enable this feautre since it is way more convenient with testing with real devices.