Skip to content

Commit 1fdeb14

Browse files
Fatme HavaluovaFatme Havaluova
Fatme Havaluova
authored and
Fatme Havaluova
committed
Fix run/debug after livesync
Due to some policy restrictions on devices with apilevel 21+, android runtime is not able to delete sync directories. This way if some files are changed after livesync, changes are not applied on the device. Fixes #943
1 parent 138a834 commit 1fdeb14

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

lib/definitions/project.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ interface IPlatformProjectService {
5151
removePluginNativeCode(pluginData: IPluginData): IFuture<void>;
5252
afterPrepareAllPlugins(): IFuture<void>;
5353
getAppResourcesDestinationDirectoryPath(): IFuture<string>;
54+
deploy(device: Mobile.IDevice, appIdentifier: string): IFuture<void>;
5455
}
5556

5657
interface IAndroidProjectPropertiesManager {

lib/services/android-project-service.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
2828
private $projectData: IProjectData,
2929
private $projectDataService: IProjectDataService,
3030
private $propertiesParser: IPropertiesParser,
31-
private $sysInfo: ISysInfo) {
31+
private $sysInfo: ISysInfo,
32+
private $mobileHelper: Mobile.IMobileHelper) {
3233
super($fs);
3334
this._androidProjectPropertiesManagers = Object.create(null);
3435
}
@@ -285,6 +286,15 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
285286
return Future.fromResult();
286287
}
287288

289+
public deploy(device: Mobile.IAndroidDevice, appIdentifier: string): IFuture<void> {
290+
return (() => {
291+
let deviceRootPath = `/data/local/tmp/${appIdentifier}`;
292+
device.adb.executeShellCommand(["rm", "-rf", this.$mobileHelper.buildDevicePath(deviceRootPath, "fullsync")]).wait();
293+
device.adb.executeShellCommand(["rm", "-rf", this.$mobileHelper.buildDevicePath(deviceRootPath, "sync")]).wait();
294+
device.adb.executeShellCommand(["rm", "-rf", this.$mobileHelper.buildDevicePath(deviceRootPath, "removedsync")]).wait();
295+
}).future<void>()();
296+
}
297+
288298
private _canUseGradle: boolean;
289299
private canUseGradle(frameworkVersion?: string): IFuture<boolean> {
290300
return (() => {

lib/services/ios-project-service.ts

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as xcode from "xcode";
1010
import * as constants from "../constants";
1111
import * as helpers from "../common/helpers";
1212
import * as projectServiceBaseLib from "./platform-project-service-base";
13+
import Future = require("fibers/future");
1314

1415
export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase implements IPlatformProjectService {
1516
private static XCODE_PROJECT_EXT_NAME = ".xcodeproj";
@@ -207,6 +208,10 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
207208
}).future<void>()();
208209
}
209210

211+
public deploy(device: Mobile.IDevice, appIdentifier: string): IFuture<void> {
212+
return Future.fromResult();
213+
}
214+
210215
private addDynamicFramework(frameworkPath: string): IFuture<void> {
211216
return (() => {
212217
this.validateFramework(frameworkPath).wait();

lib/services/platform-service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ export class PlatformService implements IPlatformService {
274274
this.$devicesServices.initialize({platform: platform, deviceId: this.$options.device}).wait();
275275
let action = (device: Mobile.IDevice): IFuture<void> => {
276276
return (() => {
277+
platformData.platformProjectService.deploy(device, this.$projectData.projectId).wait();
277278
device.deploy(packageFile, this.$projectData.projectId).wait();
278279

279280
if (!this.$options.justlaunch) {

0 commit comments

Comments
 (0)