android launch issues. Unsupported class file major version 57

前端 未结 6 497
耶瑟儿~
耶瑟儿~ 2020-12-07 00:35

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

6条回答
  •  离开以前
    2020-12-07 01:10

    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 ..." to update what will be committed)
      (use "git restore ..." 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.

提交回复
热议问题