diff --git a/lib/common b/lib/common index 6ca968917e..649967a2f1 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit 6ca968917e662822e338ae5352a0d6383e0108f5 +Subproject commit 649967a2f1732f7bc710fd59cf617b6603dc7b1c diff --git a/lib/definitions/project.d.ts b/lib/definitions/project.d.ts index 2ea623289a..809bf76318 100644 --- a/lib/definitions/project.d.ts +++ b/lib/definitions/project.d.ts @@ -53,7 +53,7 @@ interface IPlatformProjectService { removePluginNativeCode(pluginData: IPluginData): IFuture; afterPrepareAllPlugins(): IFuture; getAppResourcesDestinationDirectoryPath(): IFuture; - deploy(device: Mobile.IDevice, appIdentifier: string): IFuture; + deploy(deviceIdentifier: string): IFuture; } interface IAndroidProjectPropertiesManager { diff --git a/lib/services/android-project-service.ts b/lib/services/android-project-service.ts index 6258755bdc..246f2c7755 100644 --- a/lib/services/android-project-service.ts +++ b/lib/services/android-project-service.ts @@ -6,6 +6,7 @@ import Future = require("fibers/future"); import * as constants from "../constants"; import * as semver from "semver"; import * as projectServiceBaseLib from "./platform-project-service-base"; +import * as androidDebugBridgePath from "../common/mobile/android/android-debug-bridge"; class AndroidProjectService extends projectServiceBaseLib.PlatformProjectServiceBase implements IPlatformProjectService { private static VALUES_DIRNAME = "values"; @@ -28,7 +29,8 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService $projectData: IProjectData, $projectDataService: IProjectDataService, private $sysInfo: ISysInfo, - private $mobileHelper: Mobile.IMobileHelper) { + private $mobileHelper: Mobile.IMobileHelper, + private $injector: IInjector) { super($fs, $projectData, $projectDataService); this._androidProjectPropertiesManagers = Object.create(null); } @@ -285,10 +287,11 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService return Future.fromResult(); } - public deploy(device: Mobile.IAndroidDevice, appIdentifier: string): IFuture { + public deploy(deviceIdentifier: string): IFuture { return (() => { - let deviceRootPath = `/data/local/tmp/${appIdentifier}`; - device.adb.executeShellCommand(["rm", "-rf", this.$mobileHelper.buildDevicePath(deviceRootPath, "fullsync"), + let adb = this.$injector.resolve(androidDebugBridgePath.AndroidDebugBridge, { identifier: deviceIdentifier }); + let deviceRootPath = `/data/local/tmp/${this.$projectData.projectId}`; + adb.executeShellCommand(["rm", "-rf", this.$mobileHelper.buildDevicePath(deviceRootPath, "fullsync"), this.$mobileHelper.buildDevicePath(deviceRootPath, "sync"), this.$mobileHelper.buildDevicePath(deviceRootPath, "removedsync")]).wait(); }).future()(); diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index e26a1a3aed..b15117a830 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -212,7 +212,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ }).future()(); } - public deploy(device: Mobile.IDevice, appIdentifier: string): IFuture { + public deploy(deviceIdentifier: string): IFuture { return Future.fromResult(); } diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index 1967cd7b34..00eb033677 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -276,7 +276,7 @@ export class PlatformService implements IPlatformService { this.$devicesServices.initialize({platform: platform, deviceId: this.$options.device}).wait(); let action = (device: Mobile.IDevice): IFuture => { return (() => { - platformData.platformProjectService.deploy(device, this.$projectData.projectId).wait(); + platformData.platformProjectService.deploy(device.deviceInfo.identifier).wait(); device.deploy(packageFile, this.$projectData.projectId).wait(); if (!this.$options.justlaunch) { @@ -301,6 +301,9 @@ export class PlatformService implements IPlatformService { emulatorServices.checkAvailability().wait(); emulatorServices.checkDependencies().wait(); + let emulatorId = emulatorServices.getEmulatorId().wait(); + platformData.platformProjectService.deploy(emulatorId).wait(); + if(!this.$options.availableDevices) { this.buildPlatform(platform, buildConfig).wait(); diff --git a/test/stubs.ts b/test/stubs.ts index d990fd042c..fe5f4f5ebc 100644 --- a/test/stubs.ts +++ b/test/stubs.ts @@ -325,7 +325,7 @@ export class PlatformProjectServiceStub implements IPlatformProjectService { afterPrepareAllPlugins(): IFuture { return Future.fromResult(); } - deploy(device: Mobile.IAndroidDevice, appIdentifier: string): IFuture { + deploy(deviceIdentifier: string): IFuture { return Future.fromResult(); } }