microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
src/extension/android/androidPlatform.ts
389lines · modeblame
52f3873ddigeff10 years ago | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for details. | |
| 3 | | |
df8c800dArtem Egorov8 years ago | 4 | import * as semver from "semver"; |
09f6024fHeniker4 years ago | 5 | import * as nls from "vscode-nls"; |
4cd25962JiglioNero4 years ago | 6 | import { MobilePlatformDeps, TargetType } from "../generalPlatform"; |
8df5011eYuri Skorokhodov5 years ago | 7 | import { IAndroidRunOptions, PlatformType } from "../launchArgs"; |
| 8 | import { Package } from "../../common/node/package"; | |
| 9 | import { OutputVerifier, PatternToFailure } from "../../common/outputVerifier"; | |
| 10 | import { TelemetryHelper } from "../../common/telemetryHelper"; | |
| 11 | import { CommandExecutor } from "../../common/commandExecutor"; | |
d7d405aeYuri Skorokhodov7 years ago | 12 | import { InternalErrorCode } from "../../common/error/internalErrorCode"; |
| 13 | import { ErrorHelper } from "../../common/error/errorHelper"; | |
4bb0956eRedMickey5 years ago | 14 | import { notNullOrUndefined } from "../../common/utils"; |
ce5e88eeYuri Skorokhodov5 years ago | 15 | import { PromiseUtil } from "../../common/node/promise"; |
09f6024fHeniker4 years ago | 16 | import { GeneralMobilePlatform } from "../generalMobilePlatform"; |
47927908RedMickey4 years ago | 17 | import { ProjectVersionHelper } from "../../common/projectVersionHelper"; |
8df5011eYuri Skorokhodov5 years ago | 18 | import { LogCatMonitorManager } from "./logCatMonitorManager"; |
4cd25962JiglioNero4 years ago | 19 | import { AndroidTarget, AndroidTargetManager } from "./androidTargetManager"; |
| 20 | import { AdbHelper, AndroidAPILevel } from "./adb"; | |
09f6024fHeniker4 years ago | 21 | import { LogCatMonitor } from "./logCatMonitor"; |
| 22 | import { PackageNameResolver } from "./packageNameResolver"; | |
| 23 | | |
34472878RedMickey5 years ago | 24 | nls.config({ |
| 25 | messageFormat: nls.MessageFormat.bundle, | |
| 26 | bundleFormat: nls.BundleFormat.standalone, | |
| 27 | })(); | |
d7d405aeYuri Skorokhodov7 years ago | 28 | const localize = nls.loadMessageBundle(); |
5c8365a6Artem Egorov8 years ago | 29 | |
52f3873ddigeff10 years ago | 30 | /** |
| 31 | * Android specific platform implementation for debugging RN applications. | |
| 32 | */ | |
299b0557Patricio Beltran10 years ago | 33 | export class AndroidPlatform extends GeneralMobilePlatform { |
0a68f8dbArtem Egorov8 years ago | 34 | // We should add the common Android build/run errors we find to this list |
34472878RedMickey5 years ago | 35 | private static RUN_ANDROID_FAILURE_PATTERNS: PatternToFailure[] = [ |
| 36 | { | |
| 37 | pattern: "Failed to install on any devices", | |
| 38 | errorCode: InternalErrorCode.AndroidCouldNotInstallTheAppOnAnyAvailibleDevice, | |
| 39 | }, | |
| 40 | { | |
| 41 | pattern: "com.android.ddmlib.ShellCommandUnresponsiveException", | |
| 42 | errorCode: InternalErrorCode.AndroidShellCommandTimedOut, | |
| 43 | }, | |
| 44 | { | |
| 45 | pattern: "Android project not found", | |
| 46 | errorCode: InternalErrorCode.AndroidProjectNotFound, | |
| 47 | }, | |
| 48 | { | |
| 49 | pattern: "error: more than one device/emulator", | |
| 50 | errorCode: InternalErrorCode.AndroidMoreThanOneDeviceOrEmulator, | |
| 51 | }, | |
| 52 | { | |
09f6024fHeniker4 years ago | 53 | pattern: /^Error: Activity class {.*} does not exist\.$/m, |
34472878RedMickey5 years ago | 54 | errorCode: InternalErrorCode.AndroidFailedToLaunchTheSpecifiedActivity, |
| 55 | }, | |
| 56 | ]; | |
| 57 | | |
| 58 | private static RUN_ANDROID_SUCCESS_PATTERNS: string[] = [ | |
| 59 | "BUILD SUCCESSFUL", | |
| 60 | "Starting the app", | |
| 61 | "Starting: Intent", | |
| 62 | ]; | |
52f3873ddigeff10 years ago | 63 | |
| 64 | private packageName: string; | |
db6fd42aRuslan Bikkinin7 years ago | 65 | private adbHelper: AdbHelper; |
8df5011eYuri Skorokhodov5 years ago | 66 | private logCatMonitor: LogCatMonitor | null = null; |
52f3873ddigeff10 years ago | 67 | private needsToLaunchApps: boolean = false; |
db6fd42aRuslan Bikkinin7 years ago | 68 | |
4cd25962JiglioNero4 years ago | 69 | protected targetManager: AndroidTargetManager; |
| 70 | protected target?: AndroidTarget; | |
52f3873ddigeff10 years ago | 71 | |
299b0557Patricio Beltran10 years ago | 72 | // We set remoteExtension = null so that if there is an instance of androidPlatform that wants to have it's custom remoteExtension it can. This is specifically useful for tests. |
7daed3fcArtem Egorov8 years ago | 73 | constructor(protected runOptions: IAndroidRunOptions, platformDeps: MobilePlatformDeps = {}) { |
0a68f8dbArtem Egorov8 years ago | 74 | super(runOptions, platformDeps); |
4dfb1c4cetatanova5 years ago | 75 | this.adbHelper = new AdbHelper( |
| 76 | this.runOptions.projectRoot, | |
| 77 | runOptions.nodeModulesRoot, | |
| 78 | this.logger, | |
| 79 | ); | |
4cd25962JiglioNero4 years ago | 80 | this.targetManager = new AndroidTargetManager(this.adbHelper); |
db6fd42aRuslan Bikkinin7 years ago | 81 | } |
43e1a996Ruslan Bikkinin7 years ago | 82 | |
4cd25962JiglioNero4 years ago | 83 | public showDevMenu(deviceId?: string): Promise<void> { |
| 84 | return this.adbHelper.showDevMenu(deviceId); | |
52f3873ddigeff10 years ago | 85 | } |
| 86 | | |
4cd25962JiglioNero4 years ago | 87 | public reloadApp(deviceId?: string): Promise<void> { |
| 88 | return this.adbHelper.reloadApp(deviceId); | |
| 89 | } | |
| 90 | | |
| 91 | public async getTarget(): Promise<AndroidTarget> { | |
| 92 | if (!this.target) { | |
| 93 | const onlineTargets = await this.adbHelper.getOnlineTargets(); | |
| 94 | const target = await this.getTargetFromRunArgs(); | |
| 95 | if (target) { | |
| 96 | this.target = target; | |
| 97 | } else { | |
| 98 | const onlineTargetsBySpecifiedType = onlineTargets.filter(target => { | |
| 99 | switch (this.runOptions.target) { | |
| 100 | case TargetType.Simulator: | |
| 101 | return target.isVirtualTarget; | |
| 102 | case TargetType.Device: | |
| 103 | return !target.isVirtualTarget; | |
| 104 | case undefined: | |
| 105 | case "": | |
| 106 | return true; | |
| 107 | default: | |
| 108 | return target.id === this.runOptions.target; | |
| 109 | } | |
| 110 | }); | |
| 111 | if (onlineTargetsBySpecifiedType.length) { | |
| 112 | this.target = AndroidTarget.fromInterface(onlineTargetsBySpecifiedType[0]); | |
| 113 | } else if (onlineTargets.length) { | |
| 114 | this.logger.warning( | |
| 115 | localize( | |
| 116 | "ThereIsNoOnlineTargetWithSpecifiedTargetType", | |
| 117 | "There is no any online target with specified target type '{0}'. Continue with any online target.", | |
| 118 | this.runOptions.target, | |
| 119 | ), | |
| 120 | ); | |
| 121 | this.target = AndroidTarget.fromInterface(onlineTargets[0]); | |
| 122 | } else { | |
| 123 | throw ErrorHelper.getInternalError( | |
| 124 | InternalErrorCode.AndroidThereIsNoAnyOnlineDebuggableTarget, | |
| 125 | ); | |
| 126 | } | |
0d77292aJiglioNero4 years ago | 127 | } |
68a5b8d5JiglioNero5 years ago | 128 | } |
4cd25962JiglioNero4 years ago | 129 | return this.target; |
68a5b8d5JiglioNero5 years ago | 130 | } |
| 131 | | |
0d77292aJiglioNero4 years ago | 132 | public async runApp(shouldLaunchInAllDevices: boolean = false): Promise<void> { |
549baae2RedMickey6 years ago | 133 | let extProps: any = { |
031832ffArtem Egorov8 years ago | 134 | platform: { |
259c018fYuri Skorokhodov5 years ago | 135 | value: PlatformType.Android, |
031832ffArtem Egorov8 years ago | 136 | isPii: false, |
| 137 | }, | |
| 138 | }; | |
| 139 | | |
549baae2RedMickey6 years ago | 140 | if (this.runOptions.isDirect) { |
| 141 | extProps.isDirect = { | |
| 142 | value: true, | |
| 143 | isPii: false, | |
| 144 | }; | |
e7a2c40dRedMickey4 years ago | 145 | this.projectObserver?.updateRNAndroidHermesProjectState(true); |
549baae2RedMickey6 years ago | 146 | } |
| 147 | | |
34472878RedMickey5 years ago | 148 | extProps = TelemetryHelper.addPlatformPropertiesToTelemetryProperties( |
| 149 | this.runOptions, | |
| 150 | this.runOptions.reactNativeVersions, | |
| 151 | extProps, | |
| 152 | ); | |
ba953e9fRedMickey6 years ago | 153 | |
0d77292aJiglioNero4 years ago | 154 | await TelemetryHelper.generate("AndroidPlatform.runApp", extProps, async () => { |
34472878RedMickey5 years ago | 155 | const env = GeneralMobilePlatform.getEnvArgument( |
| 156 | process.env, | |
| 157 | this.runOptions.env, | |
| 158 | this.runOptions.envFile, | |
| 159 | ); | |
78c2b4deRedMickey6 years ago | 160 | |
e3706a1cRedMickey6 years ago | 161 | if ( |
34472878RedMickey5 years ago | 162 | !semver.valid( |
| 163 | this.runOptions.reactNativeVersions.reactNativeVersion, | |
09f6024fHeniker4 years ago | 164 | ) /* Custom RN implementations should support this flag*/ || |
34472878RedMickey5 years ago | 165 | semver.gte( |
| 166 | this.runOptions.reactNativeVersions.reactNativeVersion, | |
| 167 | AndroidPlatform.NO_PACKAGER_VERSION, | |
47927908RedMickey4 years ago | 168 | ) || |
| 169 | ProjectVersionHelper.isCanaryVersion( | |
| 170 | this.runOptions.reactNativeVersions.reactNativeVersion, | |
34472878RedMickey5 years ago | 171 | ) |
e3706a1cRedMickey6 years ago | 172 | ) { |
| 173 | this.runArguments.push("--no-packager"); | |
| 174 | } | |
| 175 | | |
09f6024fHeniker4 years ago | 176 | const mainActivity = GeneralMobilePlatform.getOptFromRunArgs( |
34472878RedMickey5 years ago | 177 | this.runArguments, |
| 178 | "--main-activity", | |
| 179 | ); | |
e3706a1cRedMickey6 years ago | 180 | |
| 181 | if (mainActivity) { | |
| 182 | this.adbHelper.setLaunchActivity(mainActivity); | |
4bb0956eRedMickey5 years ago | 183 | } else if (notNullOrUndefined(this.runOptions.debugLaunchActivity)) { |
e3706a1cRedMickey6 years ago | 184 | this.runArguments.push("--main-activity", this.runOptions.debugLaunchActivity); |
| 185 | this.adbHelper.setLaunchActivity(this.runOptions.debugLaunchActivity); | |
| 186 | } | |
| 187 | | |
34472878RedMickey5 years ago | 188 | const runAndroidSpawn = new CommandExecutor( |
4dfb1c4cetatanova5 years ago | 189 | this.runOptions.nodeModulesRoot, |
34472878RedMickey5 years ago | 190 | this.projectPath, |
| 191 | this.logger, | |
| 192 | ).spawnReactCommand("run-android", this.runArguments, { env }); | |
e3706a1cRedMickey6 years ago | 193 | const output = new OutputVerifier( |
34472878RedMickey5 years ago | 194 | () => Promise.resolve(AndroidPlatform.RUN_ANDROID_SUCCESS_PATTERNS), |
| 195 | () => Promise.resolve(AndroidPlatform.RUN_ANDROID_FAILURE_PATTERNS), | |
| 196 | PlatformType.Android, | |
| 197 | ).process(runAndroidSpawn); | |
e3706a1cRedMickey6 years ago | 198 | |
4cd25962JiglioNero4 years ago | 199 | let devicesIdsForLaunch: string[] = []; |
| 200 | const onlineTargetsIds = (await this.adbHelper.getOnlineTargets()).map( | |
| 201 | target => target.id, | |
| 202 | ); | |
| 203 | let targetId: string | undefined; | |
0d77292aJiglioNero4 years ago | 204 | try { |
| 205 | try { | |
| 206 | await output; | |
| 207 | } finally { | |
4cd25962JiglioNero4 years ago | 208 | targetId = await this.getTargetIdForRunApp(onlineTargetsIds); |
| 209 | this.packageName = await this.getPackageName(); | |
| 210 | devicesIdsForLaunch = [targetId]; | |
0d77292aJiglioNero4 years ago | 211 | } |
| 212 | } catch (error) { | |
4cd25962JiglioNero4 years ago | 213 | if (!targetId) { |
| 214 | targetId = await this.getTargetIdForRunApp(onlineTargetsIds); | |
| 215 | } | |
0d77292aJiglioNero4 years ago | 216 | if ( |
| 217 | error.message === | |
| 218 | ErrorHelper.getInternalError( | |
| 219 | InternalErrorCode.AndroidMoreThanOneDeviceOrEmulator, | |
| 220 | ).message && | |
4cd25962JiglioNero4 years ago | 221 | onlineTargetsIds.length >= 1 && |
| 222 | targetId | |
0d77292aJiglioNero4 years ago | 223 | ) { |
| 224 | /* If it failed due to multiple devices, we'll apply this workaround to make it work anyways */ | |
| 225 | this.needsToLaunchApps = true; | |
4cd25962JiglioNero4 years ago | 226 | devicesIdsForLaunch = shouldLaunchInAllDevices ? onlineTargetsIds : [targetId]; |
0d77292aJiglioNero4 years ago | 227 | } else { |
| 228 | throw error; | |
| 229 | } | |
| 230 | } | |
| 231 | | |
4cd25962JiglioNero4 years ago | 232 | await PromiseUtil.forEach(devicesIdsForLaunch, deviceId => |
| 233 | this.launchAppWithADBReverseAndLogCat(deviceId), | |
0d77292aJiglioNero4 years ago | 234 | ); |
52f3873ddigeff10 years ago | 235 | }); |
| 236 | } | |
| 237 | | |
4cd25962JiglioNero4 years ago | 238 | public async enableJSDebuggingMode(): Promise<void> { |
34472878RedMickey5 years ago | 239 | return this.adbHelper.switchDebugMode( |
| 240 | this.runOptions.projectRoot, | |
| 241 | this.packageName, | |
| 242 | true, | |
4cd25962JiglioNero4 years ago | 243 | (await this.getTarget()).id, |
69ad2ab3RedMickey5 years ago | 244 | this.getAppIdSuffixFromRunArgumentsIfExists(), |
34472878RedMickey5 years ago | 245 | ); |
b57ea017Artem Egorov8 years ago | 246 | } |
| 247 | | |
4cd25962JiglioNero4 years ago | 248 | public async disableJSDebuggingMode(): Promise<void> { |
34472878RedMickey5 years ago | 249 | return this.adbHelper.switchDebugMode( |
| 250 | this.runOptions.projectRoot, | |
| 251 | this.packageName, | |
| 252 | false, | |
4cd25962JiglioNero4 years ago | 253 | (await this.getTarget()).id, |
69ad2ab3RedMickey5 years ago | 254 | this.getAppIdSuffixFromRunArgumentsIfExists(), |
34472878RedMickey5 years ago | 255 | ); |
52f3873ddigeff10 years ago | 256 | } |
| 257 | | |
ce5e88eeYuri Skorokhodov5 years ago | 258 | public prewarmBundleCache(): Promise<void> { |
259c018fYuri Skorokhodov5 years ago | 259 | return this.packager.prewarmBundleCache(PlatformType.Android); |
299b0557Patricio Beltran10 years ago | 260 | } |
| 261 | | |
cbc7ac5bArtem Egorov7 years ago | 262 | public getRunArguments(): string[] { |
8022afdfVladimir Kotikov8 years ago | 263 | let runArguments: string[] = []; |
| 264 | | |
8df5011eYuri Skorokhodov5 years ago | 265 | if (this.runOptions.runArguments && this.runOptions.runArguments.length > 0) { |
8022afdfVladimir Kotikov8 years ago | 266 | runArguments = this.runOptions.runArguments; |
| 267 | } else { | |
| 268 | if (this.runOptions.variant) { | |
| 269 | runArguments.push("--variant", this.runOptions.variant); | |
| 270 | } | |
| 271 | if (this.runOptions.target) { | |
34472878RedMickey5 years ago | 272 | if ( |
4cd25962JiglioNero4 years ago | 273 | this.runOptions.target !== TargetType.Device && |
| 274 | this.runOptions.target !== TargetType.Simulator | |
34472878RedMickey5 years ago | 275 | ) { |
cbc7ac5bArtem Egorov7 years ago | 276 | runArguments.push("--deviceId", this.runOptions.target); |
| 277 | } | |
8022afdfVladimir Kotikov8 years ago | 278 | } |
| 279 | } | |
| 280 | | |
| 281 | return runArguments; | |
| 282 | } | |
| 283 | | |
34472878RedMickey5 years ago | 284 | public dispose(): void { |
8df5011eYuri Skorokhodov5 years ago | 285 | if (this.logCatMonitor) { |
| 286 | LogCatMonitorManager.delMonitor(this.logCatMonitor.deviceId); | |
| 287 | this.logCatMonitor = null; | |
| 288 | } | |
| 289 | } | |
| 290 | | |
4cd25962JiglioNero4 years ago | 291 | public async getTargetFromRunArgs(): Promise<AndroidTarget | undefined> { |
| 292 | if (this.runOptions.runArguments && this.runOptions.runArguments.length) { | |
| 293 | const deviceId = GeneralMobilePlatform.getOptFromRunArgs( | |
| 294 | this.runOptions.runArguments, | |
| 295 | "--deviceId", | |
| 296 | ); | |
| 297 | if (deviceId) { | |
| 298 | return new AndroidTarget(true, this.adbHelper.isVirtualTarget(deviceId), deviceId); | |
| 299 | } | |
| 300 | } | |
| 301 | return undefined; | |
| 302 | } | |
| 303 | | |
| 304 | private async getTargetIdForRunApp(onlineTargetsIds: string[]): Promise<string> { | |
| 305 | let deviceId: string | undefined; | |
| 306 | if (this.runOptions.runArguments && this.runOptions.runArguments.length) { | |
| 307 | deviceId = GeneralMobilePlatform.getOptFromRunArgs( | |
| 308 | this.runOptions.runArguments, | |
| 309 | "--deviceId", | |
| 310 | ); | |
| 311 | } | |
| 312 | return deviceId | |
| 313 | ? deviceId | |
| 314 | : this.runOptions.target && | |
| 315 | this.runOptions.target !== TargetType.Simulator && | |
| 316 | this.runOptions.target !== TargetType.Device && | |
| 317 | onlineTargetsIds.find(id => id === this.runOptions.target) | |
| 318 | ? this.runOptions.target | |
| 319 | : (await this.getTarget()).id; | |
| 320 | } | |
| 321 | | |
69ad2ab3RedMickey5 years ago | 322 | private getAppIdSuffixFromRunArgumentsIfExists(): string | undefined { |
| 323 | const appIdSuffixIndex = this.runArguments.indexOf("--appIdSuffix"); | |
| 324 | if (appIdSuffixIndex > -1) { | |
| 325 | return this.runArguments[appIdSuffixIndex + 1]; | |
| 326 | } | |
| 327 | return undefined; | |
| 328 | } | |
| 329 | | |
4cd25962JiglioNero4 years ago | 330 | private async launchAppWithADBReverseAndLogCat(deviceId: string): Promise<void> { |
| 331 | await this.configureADBReverseWhenApplicable(deviceId); | |
0d77292aJiglioNero4 years ago | 332 | if (this.needsToLaunchApps) { |
4cd25962JiglioNero4 years ago | 333 | await this.adbHelper.launchApp(this.runOptions.projectRoot, this.packageName, deviceId); |
0d77292aJiglioNero4 years ago | 334 | } |
4cd25962JiglioNero4 years ago | 335 | return this.startMonitoringLogCat(deviceId, this.runOptions.logCatArguments); |
52f3873ddigeff10 years ago | 336 | } |
| 337 | | |
4cd25962JiglioNero4 years ago | 338 | private async configureADBReverseWhenApplicable(deviceId: string): Promise<void> { |
0d77292aJiglioNero4 years ago | 339 | // For other emulators and devices we try to enable adb reverse |
4cd25962JiglioNero4 years ago | 340 | const apiVersion = await this.adbHelper.apiVersion(deviceId); |
0d77292aJiglioNero4 years ago | 341 | if (apiVersion >= AndroidAPILevel.LOLLIPOP) { |
| 342 | // If we support adb reverse | |
| 343 | try { | |
09f6024fHeniker4 years ago | 344 | void this.adbHelper.reverseAdb(deviceId, Number(this.runOptions.packagerPort)); |
0d77292aJiglioNero4 years ago | 345 | } catch (error) { |
| 346 | // "adb reverse" command could work incorrectly with remote devices, then skip the error and try to go on | |
| 347 | if ( | |
4cd25962JiglioNero4 years ago | 348 | this.adbHelper.isRemoteTarget(deviceId) && |
0d77292aJiglioNero4 years ago | 349 | error.message.includes(AndroidPlatform.RUN_ANDROID_FAILURE_PATTERNS[3].pattern) |
| 350 | ) { | |
| 351 | this.logger.warning(error.message); | |
b57ea017Artem Egorov8 years ago | 352 | } else { |
0d77292aJiglioNero4 years ago | 353 | throw error; |
b57ea017Artem Egorov8 years ago | 354 | } |
0d77292aJiglioNero4 years ago | 355 | } |
| 356 | } else { | |
| 357 | this.logger.warning( | |
| 358 | localize( | |
| 359 | "DeviceSupportsOnlyAPILevel", | |
| 360 | "Device {0} supports only API Level {1}. \n Level {2} is needed to support port forwarding via adb reverse. \n For debugging to work you'll need <Shake or press menu button> for the dev menu, \n go into <Dev Settings> and configure <Debug Server host & port for Device> to be \n an IP address of your computer that the Device can reach. More info at: \n https://facebook.github.io/react-native/docs/debugging.html#debugging-react-native-apps", | |
4cd25962JiglioNero4 years ago | 361 | deviceId, |
0d77292aJiglioNero4 years ago | 362 | apiVersion, |
| 363 | AndroidAPILevel.LOLLIPOP, | |
| 364 | ), | |
| 365 | ); | |
| 366 | } | |
52f3873ddigeff10 years ago | 367 | } |
| 368 | | |
0d77292aJiglioNero4 years ago | 369 | private async getPackageName(): Promise<string> { |
| 370 | const appName = await new Package(this.runOptions.projectRoot).name(); | |
| 371 | return new PackageNameResolver(appName).resolvePackageName(this.runOptions.projectRoot); | |
52f3873ddigeff10 years ago | 372 | } |
| 373 | | |
4cd25962JiglioNero4 years ago | 374 | private startMonitoringLogCat(deviceId: string, logCatArguments: string[]): void { |
| 375 | LogCatMonitorManager.delMonitor(deviceId); // Stop previous logcat monitor if it's running | |
0a68f8dbArtem Egorov8 years ago | 376 | |
| 377 | // this.logCatMonitor can be mutated, so we store it locally too | |
4cd25962JiglioNero4 years ago | 378 | this.logCatMonitor = new LogCatMonitor(deviceId, this.adbHelper, logCatArguments); |
8df5011eYuri Skorokhodov5 years ago | 379 | LogCatMonitorManager.addMonitor(this.logCatMonitor); |
34472878RedMickey5 years ago | 380 | this.logCatMonitor |
| 381 | .start() // The LogCat will continue running forever, so we don't wait for it | |
| 382 | .catch(error => { | |
| 383 | this.logger.warning(error); | |
| 384 | this.logger.warning( | |
| 385 | localize("ErrorWhileMonitoringLogCat", "Error while monitoring LogCat"), | |
| 386 | ); | |
| 387 | }); // The LogCatMonitor failing won't stop the debugging experience | |
0a68f8dbArtem Egorov8 years ago | 388 | } |
ef902673Vladimir Kotikov9 years ago | 389 | } |