React-native: Issues with installing new app on the device

Created on 2 Jan 2017  路  7Comments  路  Source: facebook/react-native

I am having trouble with installing every app on my device, still i am getting error

Unknown source file : UNEXPECTED TOP-LEVEL EXCEPTION:
Unknown source file : com.android.dex.DexException: Multiple dex files define La
ndroid/support/v7/appcompat/R$anim;
Unknown source file :   at com.android.dx.merge.DexMerger.readSortableTypes(DexM
erger.java:596)
Unknown source file :   at com.android.dx.merge.DexMerger.getSortedTypes(DexMerg
er.java:554)
Unknown source file :   at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerg
er.java:535)
Unknown source file :   at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.j
ava:171)
Unknown source file :   at com.android.dx.merge.DexMerger.merge(DexMerger.java:1
89)
Unknown source file :   at com.android.dx.command.dexer.Main.mergeLibraryDexBuff
ers(Main.java:502)
Unknown source file :   at com.android.dx.command.dexer.Main.runMonoDex(Main.jav
a:334)
Unknown source file :   at com.android.dx.command.dexer.Main.run(Main.java:277)
Unknown source file :   at com.android.dx.command.dexer.Main.main(Main.java:245)

Unknown source file :   at com.android.dx.command.Main.main(Main.java:106)

:app:dexDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.E
xecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_101\bin\java.exe'
' finished with non-zero exit value 2

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.

BUILD FAILED

Total time: 22.166 secs
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

(node:6876) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 2): TypeError: Cannot read property 'message' of undefined

Any tips ?

Locked

Most helpful comment

@pickfire
Try chaning Java to Java 8. I run command archlinux-java set java-8-openjdk and this command solve problem which you have.

All 7 comments

I got this error sometimes and I solve it by cleaning the project

cd android && ./gradlew clean && cd ..

I can't solve it even if I do that.

Downloading https://services.gradle.org/distributions/gradle-2.4-all.zip

Exception in thread "main" javax.net.ssl.SSLException: java.security.ProviderException: java.security.InvalidKeyException: EC parameters error
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1914)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1872)
    at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1855)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1376)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1353)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1348)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at org.gradle.wrapper.Download.downloadInternal(Download.java:58)
    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.security.ProviderException: java.security.InvalidKeyException: EC parameters error
    at sun.security.pkcs11.P11Key$P11ECPublicKey.getEncodedInternal(P11Key.java:1024)
    at sun.security.pkcs11.P11Key.equals(P11Key.java:158)
    at java.util.ArrayList.indexOf(ArrayList.java:298)
    at java.util.ArrayList.contains(ArrayList.java:281)
    at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:239)
    at sun.security.validator.Validator.validate(Validator.java:260)
    at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:326)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:231)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:126)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1459)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:213)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:961)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:897)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1033)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1342)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1369)
    ... 13 more
Caused by: java.security.InvalidKeyException: EC parameters error
    at sun.security.ec.ECParameters.getAlgorithmParameters(ECParameters.java:284)
    at sun.security.ec.ECPublicKeyImpl.<init>(ECPublicKeyImpl.java:59)
    at sun.security.pkcs11.P11Key$P11ECPublicKey.getEncodedInternal(P11Key.java:1021)
    ... 28 more
Caused by: java.security.NoSuchProviderException: no such provider: SunEC
    at sun.security.jca.GetInstance.getService(GetInstance.java:83)
    at sun.security.jca.GetInstance.getInstance(GetInstance.java:206)
    at java.security.Security.getImpl(Security.java:697)
    at java.security.AlgorithmParameters.getInstance(AlgorithmParameters.java:199)
    at sun.security.ec.ECParameters.getAlgorithmParameters(ECParameters.java:279)
    ... 30 more

@pickfire
Try chaning Java to Java 8. I run command archlinux-java set java-8-openjdk and this command solve problem which you have.

@kamilsalas
Is there any other way to solve this problem without upgrading Java version.

@durgarao150 I don't know any other solution.

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

getting same error in macOS high sierra

Was this page helpful?
0 / 5 - 0 ratings