I have followed the mac android getting started but when I run-android it fails with the following error(s). I've tried to find the answer online but I cant seem to find a solution. Ive made sure that I have the correct java jdk8 installed on my machine but im still getting this error. Any advice is greatly appreciated!
> startup failed:
General error during semantic analysis: Unsupported class file major version 57
java.lang.IllegalArgumentException: Unsupported class file major version 57
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:184)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:166)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:152)
at groovyjarjarasm.asm.ClassReader.<init>(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)
at org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:172)
at org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:128)
at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClassNullable(AsmReferenceResolver.java:59)
at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClass(AsmReferenceResolver.java:46)
at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveNonArrayType(AsmReferenceResolver.java:81)
at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveType(AsmReferenceResolver.java:72)
at org.codehaus.groovy.ast.decompiled.MemberSignatureParser.createMethodNode(MemberSignatureParser.java:55)
at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.lazyInitMembers(DecompiledClassNode.java:195)
at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.getDeclaredMethods(DecompiledClassNode.java:121)
at org.codehaus.groovy.ast.ClassNode.getMethods(ClassNode.java:912)
at org.codehaus.groovy.ast.ClassNode.tryFindPossibleMethod(ClassNode.java:1280)
at org.codehaus.groovy.control.StaticImportVisitor.transformMethodCallExpression(StaticImportVisitor.java:252)
at org.codehaus.groovy.control.StaticImportVisitor.transform(StaticImportVisitor.java:112)
at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:144)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:110)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:121)
at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitConstructorOrMethod(ClassCodeExpressionTransformer.java:55)
at org.codehaus.groovy.control.StaticImportVisitor.visitConstructorOrMethod(StaticImportVisitor.java:88)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructor(ClassCodeVisitorSupport.java:128)
at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1099)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:54)
at org.codehaus.groovy.control.StaticImportVisitor.visitClass(StaticImportVisitor.java:82)
at org.codehaus.groovy.control.CompilationUnit$14.call(CompilationUnit.java:717)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1095)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:649)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:627)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:604)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:390)
at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:89)
at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:330)
at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:327)
at org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:325)
at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.compileScript(DefaultScriptCompilationHandler.java:133)
at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.compileToDir(DefaultScriptCompilationHandler.java:93)
at org.gradle.groovy.scripts.internal.BuildOperationBackedScriptCompilationHandler$2.run(BuildOperationBackedScriptCompilationHandler.java:54)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.groovy.scripts.internal.BuildOperationBackedScriptCompilationHandler.compileToDir(BuildOperationBackedScriptCompilationHandler.java:51)
Dev environment: Mac os x 10.15
I suffer the same issue when run gradle build
. According to search from google and github. I found the gradle
current version (5.x.x) not support jdk 13. Finally, the 6.x version support it, but it has not been released, so I have to downgrade the jdk version to 12.x.
Downgrade java to 12 https://www.jverdeyen.be/mac/downgrade-brew-cask-application/
brew cask uninstall adoptopenjdk # uninstall jdk version 13.x
brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk12
To fix this error I went to the file directory at android/gradle/wrapper/gradle-wrapper.properties
and modified the distributionUrl
which was set to gradle-5.5
instead I used gradle-6.0
. For some reason, it does not recognize the 6.2 distribution, even though this is the version of gradle I am currently on. I figured this was supposed to correspond to the version but apparently not.
Instead of:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
Use:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-all.zip
This is because your JDK version doesnot support Gradle version of your project. Gradle 5 is not supported in jdk-13. Best Solution is to change your gradle version in gradle-wrapper.properties. You can set any gradle version later than 6,
Or
Got to (on Mac) Preferences>Build,Execution,Deployment>Gradle
(Windows) File>Settings>Build,Execution,Deployment>Gradle
Then under section Gradle You can choose Gradle and Java as given in picture below
You can also install gradle separately and use specified path. However I recommend you to use gradle-wrapper.properties file and Gradle JVM to internal JDK or Project JVM. This way you don't have to uninstall your JDK 13 and install downgraded JDK11 or JDK12
If you do not find this option in Android Studio, Downgrade your JDK or use first option.
If you don't want to downgrade your JDK distribution, you can use one of gradle wrapper's snapshots, which seems to work for many people (for me as well)
Source of the solution: https://github.com/gradle/gradle/issues/8681#issuecomment-524039994
To use the snapshot choose one of the files available here: https://services.gradle.org/distributions-snapshots/, head up to your PROJECT_ROOT/gradle/wrapper/gradle-wrapper.properties
file and put zip file address as a value of distributibutionUrl
I landed on this page after searching for this error when I did ./gradlew bootRun
as described in the Okta Spring Security Authentication Example. Indeed I have OpenJDK13 on Ubuntu 20:
$ java --version
openjdk 13.0.3 2020-04-14
OpenJDK Runtime Environment (build 13.0.3+3-Ubuntu-1ubuntu2)
OpenJDK 64-Bit Server VM (build 13.0.3+3-Ubuntu-1ubuntu2, mixed mode)
I didn't like the idea of downgrading my Java version, so instead I upgraded Gradle and rebuilt gradlew which is a wrapper that is specific to the project. Before attempting this solution, make sure that you're using version control or have a backup of the current project.
These were the steps:
1) Install skdkman to easily install gradle
. Using apt install
gave me an ancient version.
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
2) Check that sdkman installed correctly
sdk version
3) Install gradle 6
sdk install gradle 6.5
4) Rebuild gradlew on the same directory
gradle wrapper
5) Run application
./gradlew bootRun
You should see something like this:
Downloading https://services.gradle.org/distributions/gradle-6.5-bin.zip
.........10%..........20%..........30%..........40%.........50%..........60%..........70%..........80%.........90%..........100%
> Task :bootRun
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.5.RELEASE)
Doing git status
shows that many files have changed:
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: gradle/wrapper/gradle-wrapper.jar
modified: gradle/wrapper/gradle-wrapper.properties
modified: gradlew
modified: gradlew.bat
For my usage, I'll simply commit these changes in my own branch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With