@@ -359,8 +359,11 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
359
359
360
360
public removePluginNativeCode ( pluginData : IPluginData ) : void {
361
361
try {
362
- this . $fs . deleteDirectory ( path . join ( this . platformData . projectRoot , "configurations" , pluginData . name ) ) ;
363
- this . $fs . deleteDirectory ( path . join ( this . platformData . projectRoot , "src" , pluginData . name ) ) ;
362
+ // check whether the dependency that's being removed has native code
363
+ let pluginConfigDir = path . join ( this . platformData . projectRoot , "configurations" , pluginData . name ) ;
364
+ if ( this . $fs . exists ( pluginConfigDir ) ) {
365
+ this . cleanProject ( this . platformData . projectRoot , [ ] ) . wait ( ) ;
366
+ }
364
367
} catch ( e ) {
365
368
if ( e . code === "ENOENT" ) {
366
369
this . $logger . debug ( "No native code jars found: " + e . message ) ;
@@ -388,16 +391,23 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
388
391
389
392
let buildOptions = this . getBuildOptions ( ) ;
390
393
391
- buildOptions . unshift ( "clean" ) ;
392
-
393
394
let projectRoot = this . platformData . projectRoot ;
395
+ this . cleanProject ( projectRoot , buildOptions ) . wait ( ) ;
396
+ }
397
+ return Future . fromResult ( ) ;
398
+ }
399
+
400
+ private cleanProject ( projectRoot : string , options : string [ ] ) : IFuture < void > {
401
+ return ( ( ) => {
402
+ options . unshift ( "clean" ) ;
403
+
394
404
let gradleBin = path . join ( projectRoot , "gradlew" ) ;
395
405
if ( this . $hostInfo . isWindows ) {
396
406
gradleBin += ".bat" ;
397
407
}
398
- this . spawn ( gradleBin , buildOptions , { stdio : "inherit" , cwd : this . platformData . projectRoot } ) . wait ( ) ;
399
- }
400
- return Future . fromResult ( ) ;
408
+
409
+ this . spawn ( gradleBin , options , { stdio : "inherit" , cwd : this . platformData . projectRoot } ) . wait ( ) ;
410
+ } ) . future < void > ( ) ( ) ;
401
411
}
402
412
403
413
public deploy ( deviceIdentifier : string ) : IFuture < void > {
0 commit comments