Add a native plugin, and 'build android' lasted longer than 20 minutes

Hi,
Could someone help me on this, because I have searched a lot these days and not a method works.
Everything went well until I started to add some of the native plugins such as ‘email composer’ to my project. The ‘ionic Cordova build android’ become 20+ minutes instead of 10+ seconds.
I found this but my sdk folder is ok.
Here is my ‘ionic info’:

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.6
    Cordova Platforms  : android 6.3.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v8.9.1
    npm               : 5.5.1
    OS                : macOS High Sierra
    Xcode             : Xcode 9.2 Build version 9C40b

Environment Variables:

    ANDROID_HOME : /Users/automation/Library/Android/sdk

Misc:

    backend : pro

Build with ‘email composer’:

ionic cordova build android
Running app-scripts build: --platform android --target cordova
[15:57:04]  build dev started ...
[15:57:04]  clean started ...
[15:57:05]  clean finished in 3 ms
[15:57:05]  copy started ...
[15:57:05]  deeplinks started ...
[15:57:05]  deeplinks finished in 29 ms
[15:57:05]  transpile started ...
[15:57:08]  transpile finished in 3.71 s
[15:57:08]  preprocess started ...
[15:57:08]  preprocess finished in 1 ms
[15:57:08]  webpack started ...
[15:57:08]  copy finished in 3.99 s
[15:57:15]  webpack finished in 6.81 s
[15:57:15]  sass started ...
[15:57:16]  sass finished in 955 ms
[15:57:16]  postprocess started ...
[15:57:16]  postprocess finished in 9 ms
[15:57:16]  lint started ...
[15:57:16]  build dev finished in 11.75 s
> cordova build android
ANDROID_HOME=/Users/automation/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
Subproject Path: CordovaLib
[15:57:19]  lint finished in 2.96 s
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.

        at build_dh28z93mb5em5sd2q42eirof2.run(/Users/automation/Documents/ZhangYing/testplugin/platforms/android/build.gradle:141)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.

Incremental java compilation is an incubating feature.

The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.

:preBuild
 UP-TO-DATE
:preDebugBuild

UP-TO-DATE
:checkDebugManifest

:preReleaseBuild
 UP-TO-DATE
:CordovaLib:preBuild

UP-TO-DATE
:CordovaLib:preDebugBuild

UP-TO-DATE
:CordovaLib:checkDebugManifest

:CordovaLib:prepareDebugDependencies

:CordovaLib:compileDebugAidl

:CordovaLib:compileDebugNdk

UP-TO-DATE
:CordovaLib:compileLint

:CordovaLib:copyDebugLint

UP-TO-DATE
:CordovaLib:mergeDebugShaders

:CordovaLib:compileDebugShaders

:CordovaLib:generateDebugAssets

:CordovaLib:mergeDebugAssets

:CordovaLib:mergeDebugProguardFiles

UP-TO-DATE
:CordovaLib:packageDebugRenderscript

UP-TO-DATE
:CordovaLib:compileDebugRenderscript

:CordovaLib:generateDebugResValues

:CordovaLib:generateDebugResources

:CordovaLib:packageDebugResources

:CordovaLib:processDebugManifest

:CordovaLib:generateDebugBuildConfig

:CordovaLib:processDebugResources

:CordovaLib:generateDebugSources

:CordovaLib:incrementalDebugJavaCompilationSafeguard

:CordovaLib:compileDebugJavaWithJavac

:CordovaLib:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.
:CordovaLib:processDebugJavaRes

UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug

:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug

:CordovaLib:mergeDebugJniLibFolders

:CordovaLib:transformNative_libsWithMergeJniLibsForDebug

:CordovaLib:transformNative_libsWithSyncJniLibsForDebug

:CordovaLib:bundleDebug

:CordovaLib:preReleaseBuild
 UP-TO-DATE
:CordovaLib:checkReleaseManifest

:CordovaLib:prepareReleaseDependencies

:CordovaLib:compileReleaseAidl

:CordovaLib:compileReleaseNdk

UP-TO-DATE
:CordovaLib:copyReleaseLint

UP-TO-DATE
:CordovaLib:mergeReleaseShaders

:CordovaLib:compileReleaseShaders

:CordovaLib:generateReleaseAssets

:CordovaLib:mergeReleaseAssets

:CordovaLib:mergeReleaseProguardFiles

UP-TO-DATE
:CordovaLib:packageReleaseRenderscript

UP-TO-DATE
:CordovaLib:compileReleaseRenderscript

:CordovaLib:generateReleaseResValues

:CordovaLib:generateReleaseResources

:CordovaLib:packageReleaseResources

:CordovaLib:processReleaseManifest

:CordovaLib:generateReleaseBuildConfig

:CordovaLib:processReleaseResources

:CordovaLib:generateReleaseSources

:CordovaLib:incrementalReleaseJavaCompilationSafeguard

:CordovaLib:compileReleaseJavaWithJavac

:CordovaLib:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

:CordovaLib:processReleaseJavaRes

UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForRelease

:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease

:CordovaLib:mergeReleaseJniLibFolders

:CordovaLib:transformNative_libsWithMergeJniLibsForRelease

:CordovaLib:transformNative_libsWithSyncJniLibsForRelease

:CordovaLib:bundleRelease

:prepareComAndroidSupportSupportV42411Library

:prepareOrgApacheCordovaCordovaLib630DebugLibrary

:prepareDebugDependencies

:compileDebugAidl

:compileDebugRenderscript

:generateDebugBuildConfig

:generateDebugResValues

:generateDebugResources

:mergeDebugResources

:processDebugManifest

:processDebugResources

:generateDebugSources

:incrementalDebugJavaCompilationSafeguard

:compileDebugJavaWithJavac

:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

:compileDebugNdk

UP-TO-DATE
:compileDebugSources

:mergeDebugShaders

:compileDebugShaders

:generateDebugAssets

:mergeDebugAssets

:transformClassesWithDexForDebug

:mergeDebugJniLibFolders

:transformNative_libsWithMergeJniLibsForDebug

:processDebugJavaRes

UP-TO-DATE
:transformResourcesWithMergeJavaResForDebug

:validateSigningDebug

:packageDebug

:assembleDebug

:cdvBuildDebug


BUILD SUCCESSFUL

Total time: 20 mins 20.742 secs

Built the following apk(s):

Build without ‘email composer’:

Running app-scripts build: --platform android --target cordova
[16:26:16]  build dev started ...
[16:26:16]  clean started ...
[16:26:16]  clean finished in 3 ms
[16:26:16]  copy started ...
[16:26:16]  deeplinks started ...
[16:26:16]  deeplinks finished in 27 ms
[16:26:16]  transpile started ...
[16:26:24]  transpile finished in 7.72 s
[16:26:24]  preprocess started ...
[16:26:24]  preprocess finished in less than 1 ms
[16:26:24]  webpack started ...
[16:26:24]  copy finished in 8.43 s
[16:26:31]  webpack finished in 7.42 s
[16:26:31]  sass started ...
[16:26:33]  sass finished in 1.82 s
[16:26:33]  postprocess started ...
[16:26:33]  postprocess finished in 38 ms
[16:26:33]  lint started ...
[16:26:33]  build dev finished in 17.38 s
> cordova build android
ANDROID_HOME=/Users/automation/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
Subproject Path: CordovaLib
[16:26:49]  lint finished in 16.31 s
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.

        at build_dh28z93mb5em5sd2q42eirof2.run(/Users/automation/Documents/ZhangYing/testplugin/platforms/android/build.gradle:141)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.

Incremental java compilation is an incubating feature.

The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.

:preBuild

UP-TO-DATE
:preDebugBuild
 UP-TO-DATE
:checkDebugManifest

:CordovaLib:preBuild

UP-TO-DATE
:CordovaLib:preDebugBuild
 UP-TO-DATE
:CordovaLib:checkDebugManifest

:CordovaLib:prepareDebugDependencies

:CordovaLib:compileDebugAidl

UP-TO-DATE
:CordovaLib:compileDebugNdk

UP-TO-DATE
:CordovaLib:compileLint

UP-TO-DATE
:CordovaLib:copyDebugLint

UP-TO-DATE
:CordovaLib:mergeDebugShaders

UP-TO-DATE
:CordovaLib:compileDebugShaders
 UP-TO-DATE
:CordovaLib:generateDebugAssets
 UP-TO-DATE

:CordovaLib:mergeDebugAssets

UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles

UP-TO-DATE
:CordovaLib:packageDebugRenderscript
 UP-TO-DATE
:CordovaLib:compileDebugRenderscript

UP-TO-DATE
:CordovaLib:generateDebugResValues

UP-TO-DATE
:CordovaLib:generateDebugResources
 UP-TO-DATE
:CordovaLib:packageDebugResources

UP-TO-DATE
:CordovaLib:processDebugManifest

UP-TO-DATE
:CordovaLib:generateDebugBuildConfig

UP-TO-DATE
:CordovaLib:processDebugResources

UP-TO-DATE
:CordovaLib:generateDebugSources

UP-TO-DATE
:CordovaLib:incrementalDebugJavaCompilationSafeguard

UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac

UP-TO-DATE
:CordovaLib:processDebugJavaRes

UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug

UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug

UP-TO-DATE
:CordovaLib:mergeDebugJniLibFolders

UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug

UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug

UP-TO-DATE
:CordovaLib:bundleDebug

UP-TO-DATE
:prepareOrgApacheCordovaCordovaLib630DebugLibrary

UP-TO-DATE
:prepareDebugDependencies

:compileDebugAidl

:compileDebugRenderscript

:generateDebugBuildConfig

UP-TO-DATE
:generateDebugResValues

UP-TO-DATE
:generateDebugResources

:mergeDebugResources

:processDebugManifest

:processDebugResources

:generateDebugSources

:incrementalDebugJavaCompilationSafeguard

:compileDebugJavaWithJavac

:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:compileDebugNdk
 UP-TO-DATE

:compileDebugSources

:mergeDebugShaders
 UP-TO-DATE
:compileDebugShaders
 UP-TO-DATE
:generateDebugAssets
 UP-TO-DATE
:mergeDebugAssets

:transformClassesWithDexForDebug

:mergeDebugJniLibFolders
 UP-TO-DATE
:transformNative_libsWithMergeJniLibsForDebug

:processDebugJavaRes
 UP-TO-DATE
:transformResourcesWithMergeJavaResForDebug

:validateSigningDebug

:packageDebug

:assembleDebug

:cdvBuildDebug


BUILD SUCCESSFUL

Total time: 16.382 secs
Built the following apk(s):

Not only the ‘email composer’ plugin, but also others like ‘social sharing’, ‘barcodes scanner’ will also cause this problem.
I’m wondering whether I have made some stupid mistake somewhere…
Please help me, Thanks!

Downgrade Cordova-android 6.3.0 to 6.2.3 solve the problem.