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
Hi! I created new react native project and I can't build on android #26625
Comments
could you please share what's in the Users/lichtv/workspace/react/src/FristApp/android/settings.gradle file? |
Sure bro, |
I'm having the same issue I believe. [Update]: Solved my issue. I initiated the app using version 0.57 rather than 0.61, and that got me over the gradle issue. I then ran it, and got a new error about my JDK version. I switch to OpenJDK8 rather than JDK 13 and that seemed to work. Seems to work. |
In your android/build.gradle, do you have If so change it to |
Hi @LMestre14 Thanks to all bro |
No problem, @lichcse Took me all afternoon of messing around to finally figure that out. Yeah, since JDK 13 is really new, it wouldn't surprise me if something broke. Yeah, once I switched to the older JDK, 0.61 worked fine. Glad I could help! =) |
Hello @cjtaylor1990 could you tell me how to switch from java 13 to openJDK8 in mac? I did some uninstall and reinstall and not seems to succesed on switching the version. Thanks |
@razr130 Good luck to you |
I don't know in the case of mac. i just changed the JAVA_HOME path variable to old JDK installation and it worked |
This Solution Actually works (Y) , JDK13 is buggy |
This issue is regarding OSX, but I ran into the same problem using Arch Linux. In case anyone else does as well here's is how I fixed it:
This will downgrade from JDK13 to JDK11. |
Same issue @lichcse had on MacOS, I had on Windows. |
@paldepind You don't see a fix specifically for Arch Linux very frequently. Thanks man :) |
Go to Change the following line: - distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
+ distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip That's what worked for me with the latest versions of everything on MacOS |
For others reading, it's not that JDK 13 is buggy, it's that the packaged version of gradle doesn't support it, you either have to downgrade your JDK version, or as @MaffooBristol suggested instruct the build to use a newer version of gradle that does support Java 13. |
Are there any downsides to manually changing this version? After all, it's a major version change that RN itself would probably make itself in an upcoming release. What if there are conflicts on a future RN upgrade? |
Does JDK 12 works? |
If you have Android Studio installed, JDK is already bundled inside the app. You don't have to install it separately. Simply set these two path when compiling should work,
|
I was getting react-native version mismatch 60.5/61.5 after that change at first. |
I just emptied the C:\Users[USER].gradle\wrapper\dists\gradle-6.0.1-all folder and rebuild it. It worked for me .... |
@MaffooBristol |
If the react-native version is 0.64.0 then the distributionUrl should be https://services.gradle.org/distributions/gradle-6.7-all.zip |
React Native version:
"dependencies": { "react": "16.9.0", "react-native": "0.61.1" }
MacOS: 10.14.6
Java JDK: 13
Action:
Error:
FAILURE: Build failed with an exception.
Where:
Settings file '/Users/lichtv/workspace/react/src/FristApp/android/settings.gradle'
What went wrong:
Could not compile settings file '/Users/lichtv/workspace/react/src/FristApp/android/settings.gradle'.
java.lang.IllegalArgumentException: Unsupported class file major version 57
at groovyjarjarasm.asm.ClassReader.(ClassReader.java:184)
at groovyjarjarasm.asm.ClassReader.(ClassReader.java:166)
at groovyjarjarasm.asm.ClassReader.(ClassReader.java:152)
at groovyjarjarasm.asm.ClassReader.(ClassReader.java:273)
at org.codehaus.groovy.ast.decompiled.AsmDecompiler.parseClass(AsmDecompiler.java:81)
at org.codehaus.groovy.control.ClassNodeResolver.findDecompiled(ClassNodeResolver.java:254)
at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:192)
................ ETC .........................
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.base/java.lang.Thread.run(Thread.java:830)
1 error
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 432ms
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
Settings file '/Users/lichtv/workspace/react/src/FristApp/android/settings.gradle'
.......
HELP ME PLEASE
The text was updated successfully, but these errors were encountered: