@@ -367,8 +367,11 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
367
367
368
368
public removePluginNativeCode ( pluginData : IPluginData ) : void {
369
369
try {
370
- this . $fs . deleteDirectory ( path . join ( this . platformData . projectRoot , "configurations" , pluginData . name ) ) ;
371
- this . $fs . deleteDirectory ( path . join ( this . platformData . projectRoot , "src" , pluginData . name ) ) ;
370
+ // check whether the dependency that's being removed has native code
371
+ let pluginConfigDir = path . join ( this . platformData . projectRoot , "configurations" , pluginData . name ) ;
372
+ if ( this . $fs . exists ( pluginConfigDir ) ) {
373
+ this . cleanProject ( this . platformData . projectRoot , [ ] ) . wait ( ) ;
374
+ }
372
375
} catch ( e ) {
373
376
if ( e . code === "ENOENT" ) {
374
377
this . $logger . debug ( "No native code jars found: " + e . message ) ;
@@ -396,16 +399,24 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
396
399
397
400
let buildOptions = this . getBuildOptions ( ) ;
398
401
399
- buildOptions . unshift ( "clean" ) ;
400
-
401
402
let projectRoot = this . platformData . projectRoot ;
403
+
404
+ this . cleanProject ( projectRoot , buildOptions ) . wait ( ) ;
405
+ }
406
+ return Future . fromResult ( ) ;
407
+ }
408
+
409
+ private cleanProject ( projectRoot : string , options : string [ ] ) : IFuture < void > {
410
+ return ( ( ) => {
411
+ options . unshift ( "clean" ) ;
412
+
402
413
let gradleBin = this . useGradleWrapper ( projectRoot ) ? path . join ( projectRoot , "gradlew" ) : "gradle" ;
403
414
if ( this . $hostInfo . isWindows ) {
404
415
gradleBin += ".bat" ;
405
416
}
406
- this . spawn ( gradleBin , buildOptions , { stdio : "inherit" , cwd : this . platformData . projectRoot } ) . wait ( ) ;
407
- }
408
- return Future . fromResult ( ) ;
417
+
418
+ this . spawn ( gradleBin , options , { stdio : "inherit" , cwd : this . platformData . projectRoot } ) . wait ( ) ;
419
+ } ) . future < void > ( ) ( ) ;
409
420
}
410
421
411
422
public deploy ( deviceIdentifier : string ) : IFuture < void > {
0 commit comments