oblador / react-native-keychain

:key: Keychain Access for React Native
MIT License
3.17k stars 520 forks source link

Compilation error: cannot find symbol return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE); #361

Closed emclab closed 4 years ago

emclab commented 4 years ago

This is a new installation on a RN 0.62.2 and Nodejs 12.18.0. After yarn add react-native-keychain, the app launch of npx react-native run-android failed with the error:

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.bat app:installDebug -PreactNativeDevServerPort=8081 C:\D\code\js\xyz_app\node_modules\react-native-keychain\android\src\main\java\com\oblador\keychain\DeviceAvailability.java:30: error: cannot find symbol return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE); ^ symbol: variable FEATURE_FACE location: class PackageManager C:\D\code\js\xyz_app\node_modules\react-native-keychain\android\src\main\java\com\oblador\keychain\DeviceAvailability.java:34: error: cannot find symbol return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_IRIS); ^ symbol: variable FEATURE_IRIS location: class PackageManager 2 errors

FAILURE: Build failed with an exception.

The OS is win10. react-native-keychain is 6.1.1. Here is the package.json:

"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/native": "^5.5.1",
"@react-navigation/stack": "^5.5.1",
"react": "16.11.0",
"react-native": "0.62.2",
"react-native-device-info": "^5.6.1",
"react-native-elements": "^2.0.2",
"react-native-gesture-handler": "^1.6.1",
"react-native-keychain": "^6.1.1",
"react-native-reanimated": "^1.9.0",
"react-native-safe-area-context": "^3.0.5",
"react-native-screens": "^2.8.0",
"react-native-vector-icons": "^6.6.0"
emclab commented 4 years ago

compileSdkVersion = 28

emclab commented 4 years ago

Changed to 29 in above seems working.

babitakapoor112 commented 4 years ago

Changed to 29 in above seems working.

I have changes it already in my build.gradle file. But still the same error is coming.

fjamil91 commented 3 years ago

Any luck with this? I am using API version 30 and have tried on version 29 with no success.

sieuhuflit commented 3 years ago

Add to the last (after allprojects) android/build.gradle will work

allprojects {
  ...
}

subprojects {
    afterEvaluate {
        project ->
            if (project.hasProperty("android")) {
                android {
                    compileSdkVersion = 29
                    buildToolsVersion = "29.0.3"
                }
            }
    }
}
Aleksefo commented 3 years ago

Can confirm, @sieuhuflit solution works after updating to RN 0.64.0

opatricpires commented 2 years ago

@sieuhuflit thankyou, that works for me. :)