@@ -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 , [ ] ) ;
374
+ }
372
375
} catch ( e ) {
373
376
if ( e . code === "ENOENT" ) {
374
377
this . $logger . debug ( "No native code jars found: " + e . message ) ;
@@ -396,18 +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 ;
402
- let gradleBin = this . useGradleWrapper ( projectRoot ) ? path . join ( projectRoot , "gradlew" ) : "gradle" ;
403
- if ( this . $hostInfo . isWindows ) {
404
- gradleBin += ".bat" ;
405
- }
406
- this . spawn ( gradleBin , buildOptions , { stdio : "inherit" , cwd : this . platformData . projectRoot } ) . wait ( ) ;
403
+
404
+ this . cleanProject ( projectRoot , buildOptions ) ;
407
405
}
408
406
return Future . fromResult ( ) ;
409
407
}
410
408
409
+ private cleanProject ( projectRoot : string , options : string [ ] ) : void {
410
+ options . unshift ( "clean" ) ;
411
+
412
+ let gradleBin = this . useGradleWrapper ( projectRoot ) ? path . join ( projectRoot , "gradlew" ) : "gradle" ;
413
+ if ( this . $hostInfo . isWindows ) {
414
+ gradleBin += ".bat" ;
415
+ }
416
+
417
+ this . spawn ( gradleBin , options , { stdio : "inherit" , cwd : this . platformData . projectRoot } ) . wait ( ) ;
418
+ }
419
+
411
420
public deploy ( deviceIdentifier : string ) : IFuture < void > {
412
421
return ( ( ) => {
413
422
let adb = this . $injector . resolve ( DeviceAndroidDebugBridge , { identifier : deviceIdentifier } ) ;
0 commit comments