The ionic3 project failed to be packaged after adding a plug-in.

newly installed a blank ionic3 project, I packaged apk and everything is fine.
however, in order to test how to call native api, I found a functional module QR Scanner about QR code scanning in the documentation to test.
follow the steps in the documentation to install:
$ionic cordova plugin add cordova-plugin-qrscanner
$npm install-- save @ ionic-native/qr-scanner
so an error is reported

[ERROR] An error occurred while running cordova build android (exit code 1):

    (truncated) ... Lib: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.).
    : ? API
    : ,  -Xlint:deprecation 
    :CordovaLib:processReleaseJavaRes UP-TO-DATE
    :CordovaLib:transformResourcesWithMergeJavaResForRelease
    :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease
    :CordovaLib:mergeReleaseJniLibFolders
    :CordovaLib:transformNative_libsWithMergeJniLibsForRelease
    :CordovaLib:transformNative_libsWithSyncJniLibsForRelease
    :CordovaLib:bundleRelease
    :prepareComAndroidSupportAppcompatV72310Library
    :prepareComAndroidSupportSupportV42310Library
    :prepareComJourneyappsZxingAndroidEmbedded330Library
    :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.).
    D:\my_work\ioinc\ionic-cordova-demo\platforms\android\src\com\bitpay\cordova\qrscanner\QRScanner.java:21: :
    
    import org.apache.cordova.PermissionHelper;
                              ^
       :    PermissionHelper
       :  org.apache.cordova
    D:\my_work\ioinc\ionic-cordova-demo\platforms\android\src\com\bitpay\cordova\qrscanner\QRScanner.java:398:  :
    
                 if(!PermissionHelper.hasPermission(this, p))
                     ^
       :    PermissionHelper
       :  QRScanner
    D:\my_work\ioinc\ionic-cordova-demo\platforms\android\src\com\bitpay\cordova\qrscanner\QRScanner.java:407:  :
    
             PermissionHelper.requestPermissions(this, requestCode, permissions);
             ^
       :    PermissionHelper
       :  QRScanner
    : ? API
    : ,  -Xlint:deprecation 
    :
    D:\my_work\ioinc\ionic-cordova-demo\platforms\android\src\com\bitpay\cordova\qrscanner\QRScanner.java ?
    : ,  -Xlint:unchecked 
    3 
    :compileDebugJavaWithJavac FAILED

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ":compileDebugJavaWithJavac".
    > Compilation failed; see the compiler error output for details.

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    BUILD FAILED

    Total time: 11.76 secs
    Error: cmd: Command failed with exit code 1 Error output:
    : ? API
    : ,  -Xlint:deprecation 
    : ? API
    : ,  -Xlint:deprecation 
    D:\my_work\ioinc\ionic-cordova-demo\platforms\android\src\com\bitpay\cordova\qrscanner\QRScanner.java:21: :
    
    import org.apache.cordova.PermissionHelper;
                              ^
       :    PermissionHelper
       :  org.apache.cordova
    D:\my_work\ioinc\ionic-cordova-demo\platforms\android\src\com\bitpay\cordova\qrscanner\QRScanner.java:398:  :
    
                 if(!PermissionHelper.hasPermission(this, p))
                     ^
       :    PermissionHelper
       :  QRScanner
    D:\my_work\ioinc\ionic-cordova-demo\platforms\android\src\com\bitpay\cordova\qrscanner\QRScanner.java:407:  :
    
             PermissionHelper.requestPermissions(this, requestCode, permissions);
             ^
       :    PermissionHelper
       :  QRScanner
    : ? API
    : ,  -Xlint:deprecation 
    :
    D:\my_work\ioinc\ionic-cordova-demo\platforms\android\src\com\bitpay\cordova\qrscanner\QRScanner.java ?
    : ,  -Xlint:unchecked 
    3 

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ":compileDebugJavaWithJavac".
    > Compilation failed; see the compiler error output for details.

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    
    

_ em > what is the reason?

then I re-remove the plug-in: ionic cordova plugin remove cordova-plugin-qrscanner
and then package it again.

the problem must be caused by the installation of the plug-in. -sharp-sharp-sharp problem description

ionic info:

@ionic/cli-utils  : 1.12.0
ionic (Ionic CLI) : 3.12.0

global packages:

cordova (Cordova CLI) : 6.5.0

local packages:

@ionic/app-scripts : 3.0.0
Cordova Platforms  : none
Ionic Framework    : ionic-angular 3.7.1

System:

Android SDK Tools : 24.4.1
Node              : v8.12.0
npm               : 6.4.1
OS                : Windows 10

Misc:

backend : pro

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Apr.05,2022
Menu