react-native-keychain: 6.1.0 fails to compile on android

Was working fine on 6.0.0.

This is the error:

> 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
Note: /Users/ethanneff/Desktop/phoenix/node_modules/lottie-react-native/src/android/src/main/java/com/airbnb/android/react/lottie/LottieAnimationViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/ethanneff/Desktop/phoenix/node_modules/lottie-react-native/src/android/src/main/java/com/airbnb/android/react/lottie/LottieAnimationViewManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/ethanneff/Desktop/phoenix/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: /Users/ethanneff/Desktop/phoenix/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/ethanneff/Desktop/phoenix/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/ethanneff/Desktop/phoenix/node_modules/@react-native-firebase/analytics/android/src/main/java/io/invertase/firebase/analytics/UniversalFirebaseAnalyticsModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/ethanneff/Desktop/phoenix/node_modules/react-native-fs/android/src/main/java/com/rnfs/RNFSManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/ethanneff/Desktop/phoenix/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.
Note: /Users/ethanneff/Desktop/phoenix/node_modules/react-native-i18n/android/src/main/java/com/AlexanderZaytsev/RNI18n/RNI18nModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/Users/ethanneff/Desktop/phoenix/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
/Users/ethanneff/Desktop/phoenix/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 3m 14s

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 17
  • Comments: 16

Most upvoted comments

It seems to require upgrading compileSdkVersion to 29 located in android/build.gradle.

I had this issue with version 6.1.1 installed and fixed it by changing the following:

ext { buildToolsVersion = “28.0.3” minSdkVersion = 16 compileSdkVersion = 28 targetSdkVersion = 28 supportLibVersion = “28.0.0” }

to this:

ext { buildToolsVersion = “29.0.2” minSdkVersion = 16 compileSdkVersion = 29 targetSdkVersion = 29 supportLibVersion = “28.0.0” }

That is in build.gradle.

I then uninstalled the previous version of the app from my device and ran

cd android && ./gradlew clean

Then everything was working

Added by:

buildToolsVersion = “29.0.3” minSdkVersion = 16 compileSdkVersion = 29 targetSdkVersion = 29

But everything went wrong:

Could not resolve all files for configuration ‘:app:androidApis’. Failed to transform android.jar to match attributes {artifactType=android-mockable-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime, returnDefaultValues=false}. Execution failed for MockableJarTransform: /Users/playra/Library/Android/sdk/platforms/android-29/android.jar. Cannot create mockable android.jar /Users/playra/Library/Android/sdk/platforms/android-29/android.jar (No such file or directory)

Wouldn’t such a change make this a major release, instead of just a minor one?

@Aung-Myint-Thein @babitakapoor112 I was also banging my head against the wall why the fixed didn’t worked for me, but then realized I had this in the android/build.gradle that also had to be adjusted to 29:

...
subprojects {
    afterEvaluate {
        project ->
            if (project.hasProperty("android")) {
                android {
                    compileSdkVersion = 28
                    buildToolsVersion = "28.0.3"
                }
            }
    }
}
...

My build gradle is already as following

ext {
        kotlin_version = '1.2.50'
        buildToolsVersion = "29.0.2"
        minSdkVersion = 19
        compileSdkVersion = 29
        targetSdkVersion = 29
        supportLibVersion = "28.0.0"
        googlePlayServicesVersion   = "15.0.1"
    }

but still have the same error.

I am using React Native 0.63.2 and "react-native-keychain": "^6.1.1". Any tips? Thanks!

My build.gradle is as following: ext { buildToolsVersion = “29.0.3” minSdkVersion = 16 compileSdkVersion = 29 targetSdkVersion = 29 supportLibVersion = “29.0.3” } but I am also getting the same error Execution failed for task ‘:react-native-keychain:compileDebugJavaWithJavac’. I am unable to run my project. below is my react-native vesrion. “react”: “16.13.1”, “react-native”: “0.63.2”, “react-native-keychain”: “^6.1.1”,

upgrading compileSdkVersion to 29 worked for me! thanks @ryanlntn ! 😃