NiklasMerz / cordova-plugin-fingerprint-aio

Cordova Plugin for fingerprint sensors (and FaceID) with Android and iOS support
https://www.npmjs.com/package/cordova-plugin-fingerprint-aio
MIT License
320 stars 189 forks source link

BiometricActivity.java:89 error getSystemService #229

Closed johnjackson closed 3 years ago

johnjackson commented 4 years ago

Bug report

WechatIMG206

/Users/johnjackson/workspace/ionicpro_slide_blue_ionic4/platforms/android/app/src/main/java/de/niklasmerz/cordova/biometric/BiometricActivity.java:89: error: 找不到符号 .getSystemService(this, KeyguardManager.class); ^

Description

I got this error when I use ionic4 ionic-native plugin Fingerprint AIO (https://ionicframework.com/docs/native/fingerprint-aio),

ionic cordova run android

Environment

Environment: OS: darwin Node: v11.4.0 npm: 6.13.7

Plugins: code-push cordova-android-support-gradle-release cordova-plugin-aes256-encryption cordova-plugin-android-permissions cordova-plugin-app-version cordova-plugin-calendar cordova-plugin-camera cordova-plugin-code-push cordova-plugin-datepicker cordova-plugin-device cordova-plugin-dialogs cordova-plugin-file cordova-plugin-file-opener2 cordova-plugin-file-transfer cordova-plugin-filechooser cordova-plugin-filepath cordova-plugin-fingerprint-aio cordova-plugin-inappbrowser cordova-plugin-ionic-keyboard cordova-plugin-ionic-webview cordova-plugin-jcore cordova-plugin-network-information cordova-plugin-privacyscreen cordova-plugin-screen-orientation cordova-plugin-splashscreen cordova-plugin-statusbar cordova-plugin-whitelist cordova-plugin-zip cordova-sqlite-storage es6-promise-plugin jpush-phonegap-plugin

Android platform: Available Android targets:

id: 1 or "android-26" Name: Android 8.0.0 Type: Platform API level: 26 Revision: 2 Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in Tag/ABIs : no ABIs.

id: 2 or "android-27" Name: Android 8.1.0 Type: Platform API level: 27 Revision: 3 Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in Tag/ABIs : no ABIs.

id: 3 or "android-28" Name: Android 9 Type: Platform API level: 28 Revision: 6 Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in Tag/ABIs : no ABIs.

config.xml <<EOF <?xml version='1.0' encoding='utf-8'?>

移动脚手架v4 An awesome Ionic/Cordova app. Ionic Framework Team

EOF

package.json <<EOF { "name": "ionic4_test_plugin", "version": "0.0.1", "author": "Ionic Framework", "homepage": "https://ionicframework.com/", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/common": "~8.1.2", "@angular/compiler": "~8.1.2", "@angular/core": "~8.1.2", "@angular/forms": "~8.1.2", "@angular/http": "^5.2.11", "@angular/platform-browser": "~8.1.2", "@angular/platform-browser-dynamic": "~8.1.2", "@angular/router": "~8.1.2", "@ionic-enterprise/cordova": "^9.0.3", "@ionic-native/aes-256": "^5.21.0", "@ionic-native/android-permissions": "^5.16.0", "@ionic-native/app-version": "^5.16.0", "@ionic-native/calendar": "^5.16.0", "@ionic-native/camera": "^5.15.1", "@ionic-native/code-push": "^5.15.1", "@ionic-native/core": "^5.0.0", "@ionic-native/file": "^5.15.1", "@ionic-native/file-chooser": "^5.15.1", "@ionic-native/file-encryption": "^5.21.0", "@ionic-native/file-opener": "^5.16.0", "@ionic-native/file-path": "^5.16.0", "@ionic-native/file-transfer": "^5.15.1", "@ionic-native/fingerprint-aio": "^5.21.5", "@ionic-native/in-app-browser": "^5.16.0", "@ionic-native/media": "^5.15.1", "@ionic-native/media-capture": "^5.15.1", "@ionic-native/network": "^5.16.0", "@ionic-native/safari-view-controller": "^5.16.0", "@ionic-native/screen-orientation": "^5.16.0", "@ionic-native/splash-screen": "^5.0.0", "@ionic-native/sqlite": "^5.16.0", "@ionic-native/status-bar": "^5.0.0", "@ionic/angular": "^4.11.2", "@ionic/storage": "^2.2.0", "@jiguang-ionic/jpush": "^2.0.0", "@types/echarts": "^4.4.0", "angular-tree-component": "^8.5.1", "angular2-signaturepad": "^2.9.0", "code-push": "^3.0.1", "cordova-android": "^8.1.0", "cordova-android-support-gradle-release": "^3.0.1", "cordova-plugin-aes256-encryption": "^2.0.0", "cordova-plugin-android-permissions": "^1.0.2", "cordova-plugin-app-version": "^0.1.9", "cordova-plugin-calendar": "^5.1.5", "cordova-plugin-camera": "^4.1.0", "cordova-plugin-code-push": "^1.12.0", "cordova-plugin-datepicker": "^0.9.3", "cordova-plugin-dialogs": "^2.0.2", "cordova-plugin-file": "^6.0.2", "cordova-plugin-file-opener2": "^2.2.1", "cordova-plugin-file-transfer": "^1.7.1", "cordova-plugin-filechooser": "^1.2.0", "cordova-plugin-filepath": "^1.5.6", "cordova-plugin-fingerprint-aio": "^3.0.1", "cordova-plugin-inappbrowser": "^3.1.0", "cordova-plugin-jcore": "^1.3.1", "cordova-plugin-network-information": "^2.0.2", "cordova-plugin-screen-orientation": "^3.0.2", "cordova-plugin-zip": "^3.1.0", "cordova-sqlite-storage": "^3.4.0", "core-js": "^2.5.4", "echarts": "^4.4.0", "es6-promise-plugin": "^4.2.2", "hammerjs": "^2.0.8", "ionic-gallery-modal": "^0.2.7", "ionic4-gallery-modal": "0.0.4", "jpush-phonegap-plugin": "^3.7.3", "ng2-dragula": "^2.1.1", "ng2-pdf-viewer": "^6.0.1", "no-double-clicks": "^1.0.1", "node-sass": "^4.12.0", "rxjs": "^6.5.4", "rxjs-compat": "^6.5.3", "ts-md5": "^1.2.7", "tslib": "^1.9.0", "vconsole": "^3.3.4", "watermark": "^1.5.0", "zone.js": "~0.9.1" }, "devDependencies": { "@angular-devkit/architect": "~0.801.2", "@angular-devkit/build-angular": "~0.801.2", "@angular-devkit/core": "~8.1.2", "@angular-devkit/schematics": "~8.1.2", "@angular/cli": "~8.1.2", "@angular/compiler": "~8.1.2", "@angular/compiler-cli": "~8.1.2", "@angular/language-service": "~8.1.2", "@ionic/angular-toolkit": "~2.0.0", "@ionic/app-scripts": "^3.2.4", "@types/jasmine": "~3.3.8", "@types/jasminewd2": "~2.0.3", "@types/node": "~8.9.4", "codelyzer": "^5.0.0", "cordova-plugin-device": "^2.0.2", "cordova-plugin-ionic-keyboard": "^2.2.0", "cordova-plugin-ionic-webview": "^4.1.1", "cordova-plugin-splashscreen": "5.0.2", "cordova-plugin-statusbar": "^2.4.2", "cordova-plugin-whitelist": "1.3.3", "jasmine-core": "~3.4.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~4.1.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.1", "karma-jasmine": "~2.0.1", "karma-jasmine-html-reporter": "^1.4.0", "protractor": "~5.4.0", "ts-node": "~7.0.0", "tslint": "~5.15.0", "typescript": "~3.4.3" }, "description": "An Ionic project", "cordova": { "plugins": { "cordova-plugin-whitelist": {}, "cordova-plugin-statusbar": {}, "cordova-plugin-device": {}, "cordova-plugin-splashscreen": {}, "cordova-plugin-ionic-webview": { "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+" }, "cordova-plugin-ionic-keyboard": {}, "cordova-plugin-file": {}, "cordova-plugin-file-transfer": {}, "cordova-plugin-code-push": {}, "cordova-plugin-zip": {}, "cordova-plugin-filechooser": {}, "cordova-plugin-camera": { "ANDROID_SUPPORT_V4_VERSION": "27.+" }, "cordova-plugin-datepicker": {}, "cordova-plugin-calendar": {}, "cordova-sqlite-storage": {}, "cordova-plugin-network-information": {}, "cordova-plugin-filepath": {}, "cordova-plugin-jcore": {}, "jpush-phonegap-plugin": { "APP_KEY": "4926b5d7f61946c2817da8aa", "CHANNEL": "developer-default" }, "cordova-plugin-screen-orientation": {}, "cordova-plugin-app-version": {}, "cordova-plugin-file-opener2": { "ANDROID_SUPPORT_V4_VERSION": "27.+" }, "cordova-plugin-inappbrowser": {}, "cordova-android-support-gradle-release": { "ANDROID_SUPPORT_VERSION": "27.+" }, "cordova-plugin-android-permissions": {}, "cordova-plugin-aes256-encryption": {}, "cordova-plugin-fingerprint-aio": {} }, "platforms": [ "android" ] } } EOF

* ```
Installed platforms:
  android 8.1.0
Available platforms:
  browser ^6.0.0
  electron ^1.0.0
  ios ^5.0.0
  osx ^5.0.0
  windows ^7.0.0

Logs

> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
> Task :app:processDebugManifest UP-TO-DATE
> Task :app:processDebugResources

> Task :app:compileDebugJavaWithJavac
/Users/johnjackson/workspace/ionicpro_slide_blue_ionic4/platforms/android/app/src/main/java/de/niklasmerz/cordova/biometric/BiometricActivity.java:88: 错误: 找不到符号
        KeyguardManager keyguardManager = ContextCompat.getSystemService(this, KeyguardManager.class);
                                                       ^
  符号:   方法 getSystemService(BiometricActivity,Class)
  位置: 类 ContextCompat
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
1 个错误

> Task :app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app: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. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 11s
25 actionable tasks: 5 executed, 20 up-to-date
/Users/johnjackson/workspace/ionicpro_slide_blue_ionic4/platforms/android/gradlew: Command failed with exit code 1 Error output:
/Users/johnjackson/workspace/ionicpro_slide_blue_ionic4/platforms/android/app/src/main/java/de/niklasmerz/cordova/biometric/BiometricActivity.java:88: 错误: 找不到符号
        KeyguardManager keyguardManager = ContextCompat.getSystemService(this, KeyguardManager.class);
                                                       ^
  符号:   方法 getSystemService(BiometricActivity,Class)
  位置: 类 ContextCompat
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
1 个错误

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app: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. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 11s
[ERROR] An error occurred while running subprocess cordova.

        cordova build android --device exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.
johnjackson commented 4 years ago

the same bug: https://github.com/NiklasMerz/cordova-plugin-fingerprint-aio/issues/207

iverenshaguy commented 4 years ago

Hi. I have this same issue and uninstalling cordova-android-support-gradle-release doesn't fix it.

Galiza commented 4 years ago

I'm facing the same issue, we use Cordova 8.1.2 and Ionic 4.12.0:

Screenshot 2020-03-05 at 12 53 54
NiklasMerz commented 4 years ago

Please make sure you use Java 8.

Galiza commented 4 years ago

@NiklasMerz We use it, though.

Screenshot 2020-03-05 at 13 27 22
iverenshaguy commented 4 years ago

I fixed my issue by changing all my ANDROID_SUPPORT_VERSIONS to 28, especially the cordova-android-support-gradle-release support version. The ContextCompat for 27.+. does not have the getSystemService method so I had to make sure the support version for 28 was being used.

Galiza commented 4 years ago

@iverenshaguy Tried this, didn't work for me.

Edit: Although I found the reason why it happened to me. A 3rd party lib was actually overriding my Java to a prior version in comparison to the one we currently use.

NiklasMerz commented 3 years ago

Most likely this is just an issue with incorrect developer tools installed.