0

我正在尝试在我的应用程序中使用 React Native Keychain。我只是安装它yarn add react-native-keychain然后运行yarn run android并得到这个错误:

> Task :react-native-keychain: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.0.1/userguide/command_line_interface.html#sec:command_line_warnings
83 actionable tasks: 80 executed, 3 up-to-date
Note: /home/david/Desktop/Encarti/encarti-mobile-app-worker/node_modules/@react-native-community/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/david/Desktop/Encarti/encarti-mobile-app-worker/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
/home/david/Desktop/Encarti/encarti-mobile-app-worker/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
/home/david/Desktop/Encarti/encarti-mobile-app-worker/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.

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

我看到了这篇文章:Compilation failed (android) after installation of react-native-keychain并在那里尝试了解决方案,但它仍然失败。我该如何解决这个问题?

4

1 回答 1

0

分享您的代码更有效:)

https://github.com/oblador/react-native-keychain/issues/351#issuecomment-640788608

尝试这个 : compileSdkVersion = 29

于 2020-07-21T13:37:32.180 回答