react native cant deploy app on emulated android device

Hi,

I created a plain react native app and tried to deploy it on my android virtual device. I created the avd inside of android studio. When I create a native android app inside android studio and deploy it on the avd. There are no problems, the app will start without problems on the avd.

But when I use this working AVD for my react native app, the following error occurs:

Scanning 7 folders for symlinks in /home/andi/Workspace/ReactNative/Album/node_modules (0ms)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Downloading https://services.gradle.org/distributions/gradle-2.14.1-all.zip

Exception in thread "main" java.lang.ExceptionInInitializerError
        at java.base/javax.crypto.JceSecurityManager.<clinit>(JceSecurityManager.java:66)
        at java.base/javax.crypto.Cipher.getConfiguredPermission(Cipher.java:2610)
        at java.base/javax.crypto.Cipher.getMaxAllowedKeyLength(Cipher.java:2634)
        at java.base/sun.security.ssl.CipherSuite$BulkCipher.isUnlimited(CipherSuite.java:602)
        at java.base/sun.security.ssl.CipherSuite$BulkCipher.<init>(CipherSuite.java:574)
        at java.base/sun.security.ssl.CipherSuite$BulkCipher.<clinit>(CipherSuite.java:460)
        at java.base/sun.security.ssl.CipherSuite.<clinit>(CipherSuite.java:1074)
        at java.base/sun.security.ssl.SSLContextImpl.getApplicableSupportedCipherSuiteList(SSLContextImpl.java:354)
        at java.base/sun.security.ssl.SSLContextImpl.access$100(SSLContextImpl.java:42)
        at java.base/sun.security.ssl.SSLContextImpl$AbstractTLSContext.<clinit>(SSLContextImpl.java:590)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:292)
        at java.base/java.security.Provider$Service.getImplClass(Provider.java:1844)
        at java.base/java.security.Provider$Service.newInstance(Provider.java:1820)
        at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:236)
        at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:164)
        at java.base/javax.net.ssl.SSLContext.getInstance(SSLContext.java:169)
        at java.base/javax.net.ssl.SSLContext.getDefault(SSLContext.java:99)
        at java.base/javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:123)
        at java.base/javax.net.ssl.HttpsURLConnection.getDefaultSSLSocketFactory(HttpsURLConnection.java:335)
        at java.base/javax.net.ssl.HttpsURLConnection.<init>(HttpsURLConnection.java:292)
        at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.<init>(HttpsURLConnectionImpl.java:86)
        at java.base/sun.net.www.protocol.https.Handler.openConnection(Handler.java:62)
        at java.base/sun.net.www.protocol.https.Handler.openConnection(Handler.java:57)
        at java.base/java.net.URL.openConnection(URL.java:1051)
        at org.gradle.wrapper.Download.downloadInternal(Download.java:55)
        at org.gradle.wrapper.Download.download(Download.java:44)
        at org.gradle.wrapper.Install$1.call(Install.java:59)
        at org.gradle.wrapper.Install$1.call(Install.java:46)
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
        at org.gradle.wrapper.Install.createDist(Install.java:46)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: java.lang.SecurityException: Can not initialize cryptographic mechanism
        at java.base/javax.crypto.JceSecurity.<clinit>(JceSecurity.java:118)
        ... 33 more
Caused by: java.lang.SecurityException: Can't read cryptographic policy directory: unlimited
        at java.base/javax.crypto.JceSecurity.setupJurisdictionPolicies(JceSecurity.java:324)
        at java.base/javax.crypto.JceSecurity.access$000(JceSecurity.java:73)
        at java.base/javax.crypto.JceSecurity$1.run(JceSecurity.java:109)
        at java.base/javax.crypto.JceSecurity$1.run(JceSecurity.java:106)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/javax.crypto.JceSecurity.<clinit>(JceSecurity.java:105)
        ... 33 more
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

I have another MacOS system, tried exactly the same things and there it is working. Some people from googles search said, it can occur, when the system uses Java 9, so they switched it back to 8. But I already tried this… No solution for me.

Can someone please try to reproduce this on his system? They getting started guide is here: https://facebook.github.io/react-native/docs/getting-started.html

Would like to know, if its a problem with opensuse or my local config. Or does someone have a solution for me? :slight_smile:

Thanks in advance

According to what you posted, your code may not support openjdk, I see lines that reference Sun Java (Oracle) specifically.
Don’t know if openjdk supports them.

Recommend you install an Oraccle JDK.
Before you try Oracle though, have you installed the JDK part of openjdk (openjdk-devel)?

TSU

Hi Tsu,

thanks for your help. Fortunately I found the problem. I set

update-alternatives --config java

to set the jre version to 8. But originally it had problems with the jdk. To set the jdk version to 8 you need this command:

update-alternatives --config javac

Problem solved. Thread can be closed :good:

Absolutely yes.

A useful command to keep in mind is the following, which displays all the update-alternative groups(what is configured on your machine to be managed with update-alternatives, even there is only a single option), and you’ll find javac listed

update-alternatives --get-selections

TSU