diff --git a/lib/common b/lib/common index 180b4846f0..6546f120e1 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit 180b4846f02b27d4dce4bcfeab60f8414ff830e6 +Subproject commit 6546f120e12bee1d460cc9b34c9cc8c56897b47d diff --git a/lib/services/usb-livesync-service.ts b/lib/services/usb-livesync-service.ts index 7780cbc83f..f91c8ee8b3 100644 --- a/lib/services/usb-livesync-service.ts +++ b/lib/services/usb-livesync-service.ts @@ -36,6 +36,20 @@ export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncSer let platformData = this.$platformsData.getPlatformData(platform.toLowerCase()); let projectFilesPath = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME); + let canLiveSyncAction = (device: Mobile.IDevice, appIdentifier: string): IFuture => { + return (() => { + if(platform.toLowerCase() === "android") { + let output = (device).adb.executeShellCommand(`"echo '' | run-as ${appIdentifier}"`).wait(); + if(output.indexOf(`run-as: Package '${appIdentifier}' is unknown`) !== -1) { + this.$logger.warn(`Unable to livesync on device ${device.deviceInfo.identifier}. Consider upgrading your device OS.`); + return false; + } + } + + return true; + }).future()(); + } + let restartAppOnDeviceAction = (device: Mobile.IDevice, deviceAppData: Mobile.IDeviceAppData, localToDevicePaths?: Mobile.ILocalToDevicePathData[]): IFuture => { let platformSpecificUsbLiveSyncService = this.resolveUsbLiveSyncService(platform || this.$devicesServices.platform, device); return platformSpecificUsbLiveSyncService.restartApplication(deviceAppData, localToDevicePaths); @@ -54,7 +68,7 @@ export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncSer let watchGlob = path.join(this.$projectData.projectDir, constants.APP_FOLDER_NAME) + "/**/*"; - this.sync(platform, this.$projectData.projectId, platformData.appDestinationDirectoryPath, projectFilesPath, this.excludedProjectDirsAndFiles, watchGlob, restartAppOnDeviceAction, notInstalledAppOnDeviceAction, beforeBatchLiveSyncAction).wait(); + this.sync(platform, this.$projectData.projectId, platformData.appDestinationDirectoryPath, projectFilesPath, this.excludedProjectDirsAndFiles, watchGlob, restartAppOnDeviceAction, notInstalledAppOnDeviceAction, beforeBatchLiveSyncAction, canLiveSyncAction).wait(); }).future()(); }