I am trying to get the .aab and the .apk files to publish the android side of a react-native app to the Google Play Store. After about 2 minutes of working Task :react-native-keychain:compileReleaseJavaWithJavac FAILED is printed.

It gives a little more information but I have been unable to find anything that fixes this error.

Execution failed for task ':react-native-keychain:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

Logs:

/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/PrefsStorage.java:5: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorage.java:3: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/KeychainModule.java:4: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:8: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageFacebookConceal.java:4: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/PrefsStorage.java:33: error: cannot find symbol
    public ResultSet getEncryptedEntry(@NonNull String service) {
                                        ^
  symbol:   class NonNull
  location: class PrefsStorage
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/PrefsStorage.java:47: error: cannot find symbol
    public void removeEntry(@NonNull String service) {
                             ^
  symbol:   class NonNull
  location: class PrefsStorage
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/PrefsStorage.java:58: error: cannot find symbol
    public void storeEncryptedEntry(@NonNull String service, @NonNull EncryptionResult encryptionResult) {
                                     ^
  symbol:   class NonNull
  location: class PrefsStorage
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/PrefsStorage.java:58: error: cannot find symbol
    public void storeEncryptedEntry(@NonNull String service, @NonNull EncryptionResult encryptionResult) {
                                                              ^
  symbol:   class NonNull
  location: class PrefsStorage
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorage.java:42: error: cannot find symbol
    EncryptionResult encrypt(@NonNull String service, @NonNull String username, @NonNull String password, SecurityLevel level) throws CryptoFailedException;
                              ^
  symbol:   class NonNull
  location: interface CipherStorage
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorage.java:42: error: cannot find symbol
    EncryptionResult encrypt(@NonNull String service, @NonNull String username, @NonNull String password, SecurityLevel level) throws CryptoFailedException;
                                                       ^
  symbol:   class NonNull
  location: interface CipherStorage
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorage.java:42: error: cannot find symbol
    EncryptionResult encrypt(@NonNull String service, @NonNull String username, @NonNull String password, SecurityLevel level) throws CryptoFailedException;
                                                                                 ^
  symbol:   class NonNull
  location: interface CipherStorage
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorage.java:44: error: cannot find symbol
    DecryptionResult decrypt(@NonNull String service, @NonNull byte[] username, @NonNull byte[] password) throws CryptoFailedException;
                              ^
  symbol:   class NonNull
  location: interface CipherStorage
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorage.java:44: error: cannot find symbol
    DecryptionResult decrypt(@NonNull String service, @NonNull byte[] username, @NonNull byte[] password) throws CryptoFailedException;
                                                       ^
  symbol:   class NonNull
  location: interface CipherStorage
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorage.java:44: error: cannot find symbol
    DecryptionResult decrypt(@NonNull String service, @NonNull byte[] username, @NonNull byte[] password) throws CryptoFailedException;
                                                                                 ^
  symbol:   class NonNull
  location: interface CipherStorage
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorage.java:46: error: cannot find symbol
    void removeKey(@NonNull String service) throws KeyStoreAccessException;
                    ^
  symbol:   class NonNull
  location: interface CipherStorage
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/KeychainModule.java:186: error: cannot find symbol
    public void hasInternetCredentialsForServer(@NonNull String server, Promise promise) {
                                                 ^
  symbol:   class NonNull
  location: class KeychainModule
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/KeychainModule.java:200: error: cannot find symbol
    public void setInternetCredentialsForServer(@NonNull String server, String username, String password, String minimumSecurityLevel, ReadableMap unusedOptions, Promise promise) {
                                                 ^
  symbol:   class NonNull
  location: class KeychainModule
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/KeychainModule.java:205: error: cannot find symbol
    public void getInternetCredentialsForServer(@NonNull String server, ReadableMap unusedOptions, Promise promise) {
                                                 ^
  symbol:   class NonNull
  location: class KeychainModule
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/KeychainModule.java:210: error: cannot find symbol
    public void resetInternetCredentialsForServer(@NonNull String server, ReadableMap unusedOptions, Promise promise) {
                                                   ^
  symbol:   class NonNull
  location: class KeychainModule
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/KeychainModule.java:299: error: cannot find symbol
    @NonNull
     ^
  symbol:   class NonNull
  location: class KeychainModule
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:91: error: cannot find symbol
    public EncryptionResult encrypt(@NonNull String service, @NonNull String username, @NonNull String password, SecurityLevel level) throws CryptoFailedException {
                                     ^
  symbol:   class NonNull
  location: class CipherStorageKeystoreAESCBC
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:91: error: cannot find symbol
    public EncryptionResult encrypt(@NonNull String service, @NonNull String username, @NonNull String password, SecurityLevel level) throws CryptoFailedException {
                                                              ^
  symbol:   class NonNull
  location: class CipherStorageKeystoreAESCBC
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:91: error: cannot find symbol
    public EncryptionResult encrypt(@NonNull String service, @NonNull String username, @NonNull String password, SecurityLevel level) throws CryptoFailedException {
                                                                                        ^
  symbol:   class NonNull
  location: class CipherStorageKeystoreAESCBC
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:148: error: cannot find symbol
    private void generateKeyAndStoreUnderAlias(@NonNull String service, SecurityLevel requiredLevel) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException, CryptoFailedException {
                                                ^
  symbol:   class NonNull
  location: class CipherStorageKeystoreAESCBC
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:164: error: cannot find symbol
    public DecryptionResult decrypt(@NonNull String service, @NonNull byte[] username, @NonNull byte[] password) throws CryptoFailedException {
                                     ^
  symbol:   class NonNull
  location: class CipherStorageKeystoreAESCBC
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:164: error: cannot find symbol
    public DecryptionResult decrypt(@NonNull String service, @NonNull byte[] username, @NonNull byte[] password) throws CryptoFailedException {
                                                              ^
  symbol:   class NonNull
  location: class CipherStorageKeystoreAESCBC
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:164: error: cannot find symbol
    public DecryptionResult decrypt(@NonNull String service, @NonNull byte[] username, @NonNull byte[] password) throws CryptoFailedException {
                                                                                        ^
  symbol:   class NonNull
  location: class CipherStorageKeystoreAESCBC
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:189: error: cannot find symbol
    public void removeKey(@NonNull String service) throws KeyStoreAccessException {
                           ^
  symbol:   class NonNull
  location: class CipherStorageKeystoreAESCBC
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:265: error: cannot find symbol
    private String getDefaultServiceIfEmpty(@NonNull String service) {
                                             ^
  symbol:   class NonNull
  location: class CipherStorageKeystoreAESCBC
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:264: error: cannot find symbol
    @NonNull
     ^
  symbol:   class NonNull
  location: class CipherStorageKeystoreAESCBC
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageFacebookConceal.java:49: error: cannot find symbol
    public EncryptionResult encrypt(@NonNull String service, @NonNull String username, @NonNull String password, SecurityLevel level) throws CryptoFailedException {
                                     ^
  symbol:   class NonNull
  location: class CipherStorageFacebookConceal
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageFacebookConceal.java:49: error: cannot find symbol
    public EncryptionResult encrypt(@NonNull String service, @NonNull String username, @NonNull String password, SecurityLevel level) throws CryptoFailedException {
                                                              ^
  symbol:   class NonNull
  location: class CipherStorageFacebookConceal
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageFacebookConceal.java:49: error: cannot find symbol
    public EncryptionResult encrypt(@NonNull String service, @NonNull String username, @NonNull String password, SecurityLevel level) throws CryptoFailedException {
                                                                                        ^
  symbol:   class NonNull
  location: class CipherStorageFacebookConceal
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageFacebookConceal.java:72: error: cannot find symbol
    public DecryptionResult decrypt(@NonNull String service, @NonNull byte[] username, @NonNull byte[] password) throws CryptoFailedException {
                                     ^
  symbol:   class NonNull
  location: class CipherStorageFacebookConceal
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageFacebookConceal.java:72: error: cannot find symbol
    public DecryptionResult decrypt(@NonNull String service, @NonNull byte[] username, @NonNull byte[] password) throws CryptoFailedException {
                                                              ^
  symbol:   class NonNull
  location: class CipherStorageFacebookConceal
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageFacebookConceal.java:72: error: cannot find symbol
    public DecryptionResult decrypt(@NonNull String service, @NonNull byte[] username, @NonNull byte[] password) throws CryptoFailedException {
                                                                                        ^
  symbol:   class NonNull
  location: class CipherStorageFacebookConceal
/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageFacebookConceal.java:93: error: cannot find symbol
    public void removeKey(@NonNull String service) {
                           ^
  symbol:   class NonNull
  location: class CipherStorageFacebookConceal
Note: /Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/DeviceAvailability.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

I have also run the app in android studio and get the same error. I am especially confused because the app works when I run the npx react-native run-android command.

If any more information is needed please let me know and thank you in advance for any help!

1

There are 1 best solutions below

0
On

One of the below should work for you:

  1. Edit your build.gradle like below

    allprojects { tasks.withType(Javadoc).all { enabled = false } repositories { ... } }

If the above did not work, try below

  1. simply comment out supportLibVersion from your build.gradle then clean and rebuild.