juncocoa / react-native-biometrics-fingerid

React Native Biometrics Scanner for Android and iOS
MIT License
3 stars 1 forks source link

Got the `error: cannot find symbol` in import android.hardware.fingerprint.Fingerprint; #1

Open zzAlexzz opened 4 years ago

zzAlexzz commented 4 years ago

Hi,

I used npx react-native init TestRNBiometricsFingerid for testing this library. After installing yarn add react-native-biometrics-fingerid, then yarn android. I got below error:

info Starting JS server...
info Installing the app...

> Task :react-native-biometrics-fingerid:compileDebugJavaWithJavac FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
12 actionable tasks: 2 executed, 10 up-to-date
/Users/xxx/Documents/TestProjects/RN/TestRNBiometricsFingerid/node_modules/react-native-biometrics-fingerid/android/src/main/java/com/hieuvp/fingerprint/ReactNativeFingerprintScannerModule.java:7: error: cannot find symbol
import android.hardware.fingerprint.Fingerprint;
                                   ^
  symbol:   class Fingerprint
  location: package android.hardware.fingerprint
/Users/xxx/Documents/TestProjects/RN/TestRNBiometricsFingerid/node_modules/react-native-biometrics-fingerid/android/src/main/java/com/hieuvp/fingerprint/ReactNativeFingerprintScannerModule.java:410: error: cannot find symbol
            List<Fingerprint> li = fm.getEnrolledFingerprints();
                 ^
  symbol:   class Fingerprint
  location: class ReactNativeFingerprintScannerModule
/Users/xxx/Documents/TestProjects/RN/TestRNBiometricsFingerid/node_modules/react-native-biometrics-fingerid/android/src/main/java/com/hieuvp/fingerprint/ReactNativeFingerprintScannerModule.java:410: error: cannot find symbol
            List<Fingerprint> li = fm.getEnrolledFingerprints();
                                     ^
  symbol:   method getEnrolledFingerprints()
  location: variable fm of type FingerprintManager
/Users/xxx/Documents/TestProjects/RN/TestRNBiometricsFingerid/node_modules/react-native-biometrics-fingerid/android/src/main/java/com/hieuvp/fingerprint/ReactNativeFingerprintScannerModule.java:413: error: cannot find symbol
            for (Fingerprint item: li) {
                 ^
  symbol:   class Fingerprint
  location: class ReactNativeFingerprintScannerModule
/Users/xxx/Documents/TestProjects/RN/TestRNBiometricsFingerid/node_modules/react-native-biometrics-fingerid/android/src/main/java/com/hieuvp/fingerprint/ReactNativeFingerprintScannerModule.java:450: error: cannot find symbol
            List<Fingerprint> li = fm.getEnrolledFingerprints();
                 ^
  symbol:   class Fingerprint
  location: class ReactNativeFingerprintScannerModule
/Users/xxx/Documents/TestProjects/RN/TestRNBiometricsFingerid/node_modules/react-native-biometrics-fingerid/android/src/main/java/com/hieuvp/fingerprint/ReactNativeFingerprintScannerModule.java:450: error: cannot find symbol
            List<Fingerprint> li = fm.getEnrolledFingerprints();
                                     ^
  symbol:   method getEnrolledFingerprints()
  location: variable fm of type FingerprintManager
/Users/xxx/Documents/TestProjects/RN/TestRNBiometricsFingerid/node_modules/react-native-biometrics-fingerid/android/src/main/java/com/hieuvp/fingerprint/ReactNativeFingerprintScannerModule.java:453: error: cannot find symbol
            for (Fingerprint item : li) {
                 ^
  symbol:   class Fingerprint
  location: class ReactNativeFingerprintScannerModule
/Users/xxx/Documents/TestProjects/RN/TestRNBiometricsFingerid/node_modules/react-native-biometrics-fingerid/android/src/main/java/com/hieuvp/fingerprint/ReactNativeFingerprintScannerModule.java:483: error: cannot find symbol
            List<Fingerprint> li = fm.getEnrolledFingerprints();
                 ^
  symbol:   class Fingerprint
  location: class ReactNativeFingerprintScannerModule
/Users/xxx/Documents/TestProjects/RN/TestRNBiometricsFingerid/node_modules/react-native-biometrics-fingerid/android/src/main/java/com/hieuvp/fingerprint/ReactNativeFingerprintScannerModule.java:483: error: cannot find symbol
            List<Fingerprint> li = fm.getEnrolledFingerprints();
                                     ^
  symbol:   method getEnrolledFingerprints()
  location: variable fm of type FingerprintManager
/Users/xxx/Documents/TestProjects/RN/TestRNBiometricsFingerid/node_modules/react-native-biometrics-fingerid/android/src/main/java/com/hieuvp/fingerprint/ReactNativeFingerprintScannerModule.java:485: error: cannot find symbol
                for (Fingerprint item : li) {
                     ^
  symbol:   class Fingerprint
  location: class ReactNativeFingerprintScannerModule
Note: /Users/xxx/Documents/TestProjects/RN/TestRNBiometricsFingerid/node_modules/react-native-biometrics-fingerid/android/src/main/java/com/hieuvp/fingerprint/ReactNativeFingerprintScannerModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
10 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-biometrics-fingerid: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 5s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/xxx/Documents/TestProjects/RN/TestRNBiometricsFingerid/node_modules/react-native-biometrics-fingerid/android/src/main/java/com/hieuvp/fingerprint/ReactNativeFingerprintScannerModule.java:7: error: cannot find symbol
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

On Android API 29, it seems that it only has android.hardware.fingerprint.FingerprintManager rather than android.hardware.fingerprint.Fingerprint?

image

Any idea why it happened?

Thanks a lot! Alex

juncocoa commented 4 years ago

Learn about Android API 29 hiden, use it android.hardware.fingerprint.Fingerprint is fine