1

我正在尝试获取 .aab 和 .apk 文件以将 react-native 应用程序的 android 端发布到 Google Play 商店。大约工作 2 分钟后 Task :react-native-keychain:compileReleaseJavaWithJavac FAILED打印。

它提供了更多信息,但我一直无法找到任何修复此错误的方法。

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

日志:

/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.

我还在 android studio 中运行了该应用程序并得到了同样的错误。我特别困惑,因为当我运行npx react-native run-android命令时应用程序可以工作。

如果需要更多信息,请让我知道并提前感谢您的帮助!

4

1 回答 1

0

以下其中一项应该适合您:

  1. 在下面编辑您的build.gradle喜欢

    allprojects { tasks.withType(Javadoc).all { enabled = false } 存储库 { ... } }

如果上述方法不起作用,请尝试以下方法

  1. supportLibVersion只需从您build.gradle当时的清洁和重建中注释掉。
于 2021-02-14T12:47:43.387 回答