Skip to content

Commit abf8361

Browse files
authored
Don't uninstall before retrying to connect during app launch (flutter#134542)
When retrying to connect to the device during app launch, don't uninstall the app first. Latest test flake for flutter#120808: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8770202475999850785/+/u/run_hot_mode_dev_cycle_ios__benchmark/test_stdout Shows that it uninstalled and then tried debugging and failed, which would make sense since the app wasn't installed anymore. ``` [2023-09-11 18:02:24.555646] [STDOUT] stdout: [ +6 ms] Lost connection to device. Trying to connect again... [2023-09-11 18:02:24.556949] [STDOUT] stdout: [ +1 ms] executing: /opt/s/w/ir/x/w/recipe_cleanup/tmp53fs1szo/flutter sdk/bin/cache/artifacts/libimobiledevice/idevicesyslog -u 00008030-00144DA10185402E [2023-09-11 18:02:24.557323] [STDOUT] stdout: [ ] executing: script -t 0 /dev/null /opt/s/w/ir/x/w/recipe_cleanup/tmp53fs1szo/flutter sdk/bin/cache/artifacts/ios-deploy/ios-deploy --id 00008030-00144DA10185402E --bundle build/ios/iphoneos/Flutter Gallery.app --app_deltas build/ios/app-delta --uninstall --noinstall --debug --no-wifi --args --enable-dart-profiling --disable-vm-service-publication --enable-checked-mode --verify-entry-points [2023-09-11 18:02:24.578010] [STDOUT] stdout: [ +20 ms] [....] Waiting for iOS device to be connected [2023-09-11 18:02:24.712631] [STDOUT] stdout: [ +134 ms] [....] Using 00008030-00144DA10185402E (N104AP, iPhone 11, iphoneos, arm64e, 16.2, 20C65) a.k.a. 'iPhone 11'. [2023-09-11 18:02:24.712725] [STDOUT] stdout: [ ] ------ Uninstall phase ------ [2023-09-11 18:02:24.818293] [STDOUT] stdout: [ +105 ms] [ OK ] Uninstalled package with bundle id io.flutter.examples.gallery [2023-09-11 18:02:24.906833] [STDOUT] stdout: [ +88 ms] ------ Debug phase ------ [2023-09-11 18:02:24.906924] [STDOUT] stdout: [ ] Starting debug of 00008030-00144DA10185402E (N104AP, iPhone 11, iphoneos, arm64e, 16.2, 20C65) a.k.a. 'iPhone 11' connected through USB... [2023-09-11 18:02:25.285252] [STDOUT] stdout: [ +378 ms] [ 0%] Looking up developer disk image [2023-09-11 18:02:25.529937] [STDOUT] stdout: [ +244 ms] [ 90%] Mounting developer disk image [2023-09-11 18:02:25.545261] [STDOUT] stdout: [ +15 ms] [ 95%] Developer disk image already mounted [2023-09-11 18:02:25.587923] [STDOUT] stdout: [ +42 ms] Detected path to iOS debug symbols: "Symbol Path: /Users/swarming/Library/Developer/Xcode/iOS DeviceSupport/16.2 (20C65) arm64e/Symbols" [2023-09-11 18:02:25.857177] [STDOUT] stdout: [ +269 ms] Script started, output file is /dev/null [2023-09-11 18:02:25.857259] [STDOUT] stdout: [ ] Script done, output file is /dev/null [2023-09-11 18:02:25.857511] [STDOUT] stdout: [ ] ios-deploy exited with code 0 [2023-09-11 18:02:25.858066] [STDOUT] stderr: [ ] Could not run build/ios/iphoneos/Flutter Gallery.app on 00008030-00144DA10185402E. [2023-09-11 18:02:25.858130] [STDOUT] stderr: [ ] Try launching Xcode and selecting "Product > Run" to fix the problem: [2023-09-11 18:02:25.858214] [STDOUT] stderr: [ ] open ios/Runner.xcworkspace [2023-09-11 18:02:25.858537] [STDOUT] stdout: [ ] Installing and launching... (completed in 52.4s) [2023-09-11 18:02:25.858956] [STDOUT] stderr: [ ] Error launching application on iPhone 11. ```
1 parent 6425a3b commit abf8361

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/flutter_tools/lib/src/ios/devices.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ class IOSDevice extends Device {
543543
debuggingOptions: debuggingOptions,
544544
launchArguments: launchArguments,
545545
ipv6: ipv6,
546+
uninstallFirst: debuggingOptions.uninstallFirst,
546547
);
547548
}
548549

@@ -695,6 +696,7 @@ class IOSDevice extends Device {
695696
debuggingOptions: debuggingOptions,
696697
launchArguments: launchArguments,
697698
ipv6: ipv6,
699+
uninstallFirst: false,
698700
skipInstall: true,
699701
);
700702
installationResult = await iosDeployDebugger!.launchAndAttach() ? 0 : 1;
@@ -737,6 +739,7 @@ class IOSDevice extends Device {
737739
required DebuggingOptions debuggingOptions,
738740
required List<String> launchArguments,
739741
required bool ipv6,
742+
required bool uninstallFirst,
740743
bool skipInstall = false,
741744
}) {
742745
final DeviceLogReader deviceLogReader = getLogReader(
@@ -753,7 +756,7 @@ class IOSDevice extends Device {
753756
appDeltaDirectory: package.appDeltaDirectory,
754757
launchArguments: launchArguments,
755758
interfaceType: connectionInterface,
756-
uninstallFirst: debuggingOptions.uninstallFirst,
759+
uninstallFirst: uninstallFirst,
757760
skipInstall: skipInstall,
758761
);
759762
if (deviceLogReader is IOSDeviceLogReader) {

packages/flutter_tools/test/general.shard/ios/ios_device_start_prebuilt_test.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ FakeCommand attachDebuggerCommand({
7575
String stdout = '(lldb) run\nsuccess',
7676
Completer<void>? completer,
7777
bool isWirelessDevice = false,
78+
bool uninstallFirst = false,
7879
bool skipInstall = false,
7980
}) {
8081
return FakeCommand(
@@ -88,6 +89,8 @@ FakeCommand attachDebuggerCommand({
8889
'123',
8990
'--bundle',
9091
'/',
92+
if (uninstallFirst)
93+
'--uninstall',
9194
if (skipInstall)
9295
'--noinstall',
9396
'--debug',
@@ -349,6 +352,7 @@ void main() {
349352
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
350353
attachDebuggerCommand(
351354
stdout: '(lldb) run\nsuccess\nProcess 525 exited with status = -1 (0xffffffff) lost connection',
355+
uninstallFirst: true,
352356
),
353357
attachDebuggerCommand(
354358
stdout: '(lldb) run\nsuccess\nThe Dart VM service is listening on http://127.0.0.1:456',
@@ -375,6 +379,7 @@ void main() {
375379
debuggingOptions: DebuggingOptions.enabled(
376380
BuildInfo.debug,
377381
usingCISystem: true,
382+
uninstallFirst: true,
378383
),
379384
platformArgs: <String, dynamic>{},
380385
);

0 commit comments

Comments
 (0)