Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-native-keychain version 3.1.1 compileDebugJavaWithJavac FAILED #193

Closed
burhanyilmaz opened this issue Feb 14, 2019 · 16 comments
Closed

Comments

@burhanyilmaz
Copy link

burhanyilmaz commented Feb 14, 2019

When I building projet, throw this error. How can solve this?

> Task :react-native-keychain:compileDebugJavaWithJavac FAILED
node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherSt
orage/CipherStorageKeystoreAESCBC.java:28: error: cannot find symbol
import android.security.keystore.StrongBoxUnavailableException;
                                ^
  symbol:   class StrongBoxUnavailableException
  location: package android.security.keystore
node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:266: error: cannot find symbol
    @TargetApi(Build.VERSION_CODES.P)
                                  ^
  symbol:   variable P
  location: class VERSION_CODES
node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:270: error: cannot find symbol
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
                                                       ^
  symbol:   variable P
  location: class VERSION_CODES
node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:274: error: cannot find symbol
            return generateKey(getKeyGenSpecBuilder(service).setIsStrongBoxBacked(true).build());
                                                            ^
  symbol:   method setIsStrongBoxBacked(boolean)
  location: class Builder
node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:275: error: cannot find symbol
        } catch (StrongBoxUnavailableException e) {
                 ^
  symbol:   class StrongBoxUnavailableException
  location: class CipherStorageKeystoreAESCBC
5 errors


System:
OS: macOS 10.14.1
Shell: 3.2.57 - /bin/bash
Binaries:
Yarn: 1.13.0 - /usr/local/bin/yarn
npmPackages:
react: 16.6.3 => 16.6.3
react-native: 0.57.8 => 0.57.8

@vdpdev
Copy link

vdpdev commented Feb 14, 2019

I have the same issue

@mandrigin
Copy link
Collaborator

@vdpdev @burhanyilmaz what version of Android SDK do you use? build.gradle of your app (android/app/build.gradle)? Does changing it compileSdkVersion 28 help?

@burhanyilmaz
Copy link
Author

burhanyilmaz commented Feb 14, 2019

@vdpdev if you want to use "react-native-keychain": "3.0.0", there is no problem. Bu using 3.1.0 or 3.1.1, there is problem

@vdpdev
Copy link

vdpdev commented Feb 14, 2019

@mandrigin
Version of react-native-keychain, i'm using, is

react-native-keychain@^3.0.0-rc.3:
  version "3.0.0"

compileSdkVersion is 27
buildToolsVersion is 27.0.3

@vdpdev
Copy link

vdpdev commented Feb 14, 2019

@mandrigin
I've tried to increase compileSdkVersion from 27 to 28 and it helped
Thanks!

@burhanyilmaz
Copy link
Author

burhanyilmaz commented Feb 14, 2019

Thanks @mandrigin :) it is work. My compileSdkVersion was 27

@mandrigin
Copy link
Collaborator

mandrigin commented Feb 14, 2019

For those who lands here from Google search, the solution is here: #193 (comment)

@Thebarda
Copy link

Hello there. I've got same problem on my project and (@mandrigin) your solution worked perfectly but do you have any explanation on why we had to increase compileSdkVersion to 28 ?
Thanks in advance

@vdpdev
Copy link

vdpdev commented Feb 14, 2019

@Thebarda if you don't want to increase compileSdkVersion to 28 you can set react-native-keychain strict to 3.0.0 like this "react-native-keychain": "3.0.0",
This way is worked for me with compileSdkVersion = 27

@Thebarda
Copy link

Thank you @vdpdev it works aswell. It's strange, when I got this error I was sure to have "react-native-keychain": "3.0.0" and compileSdkVersion = 27. So, nevermind ^^

@mandrigin
Copy link
Collaborator

@Thebarda the new version of react-native-keychain supports what is called "strongbox" for better encryption keys storage, it requires API level 28: https://proandroiddev.com/android-keystore-what-is-the-difference-between-strongbox-and-hardware-backed-keys-4c276ea78fd0?gi=9b63fdc7e1e2

@Thebarda
Copy link

Very nice @mandrigin . "StrongBox" seems to be a good improvement for keys storage !

@ksetrin
Copy link

ksetrin commented Jun 16, 2020

I had this config but the project was cannot be compiled

ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
    }

After I changed to this config my project have been compiled

    ext {
        buildToolsVersion = "29.0.3"
        minSdkVersion = 16
        compileSdkVersion = 29
        targetSdkVersion = 29
    }

file android/build.gradle

@daveyjones
Copy link

@ksetrin I just installed version 6.1.1 and I also needed to set the SDK version to 29.

@osammy
Copy link

osammy commented Jul 15, 2020

    buildToolsVersion = "29.0.3"
    minSdkVersion = 16
    compileSdkVersion = 29
    targetSdkVersion = 29

This worked for me.

@farahtahir22
Copy link

I had this config but the project was cannot be compiled

ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
    }

After I changed to this config my project have been compiled

    ext {
        buildToolsVersion = "29.0.3"
        minSdkVersion = 16
        compileSdkVersion = 29
        targetSdkVersion = 29
    }

file android/build.gradle

Same here, this worked perfectly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants