Skip to content
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

Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8 #4474

Closed
amanv8060 opened this issue Mar 4, 2021 · 10 comments
Labels

Comments

@amanv8060
Copy link

Please provide:

Thank you!

@josejulio
Copy link

I think this could help you: https://jitpack.io/docs/BUILDING/#java-version

Alternatively create a jitpack.yml file in the root of your repository and specify a jdk version:

 jdk:
  - openjdk9

If your project requires a specific Java build then you can use Custom Commands to install it before the build.

@jitpack-io
Copy link
Member

Hi,

Thank you @josejulio! That's right.
For other java versions you can also use SDK Man that is available on the build servers.

You can use SDKMan in jitpack.yml:

before_install:
   - sdk install java 11.0.10-open
   - sdk use java 11.0.10-open

@amanv8060
Copy link
Author

@zhujiang521
Copy link

before_install:

  • sdk install java 11.0.10-open
  • sdk use java 11.0.10-open

还是不行,报错信息和上面一样,帮忙看看吧

agnostic-apollo added a commit to agnostic-apollo/termux-app that referenced this issue Aug 23, 2021
This reverts commit 296ee60

We do not need to bump to compileSdkVersion 31 currently, since I have decided not to bump `androidx.window` to `1.0.0-alpha10` or higher currently, since it has changed APIs and ViewUtils will break.

https://developer.android.com/jetpack/androidx/releases/window

Moreover, bumping compileSdkVersion to 31 requires openjdk 11 in build environment, which will break Jitpack library build and possibly still F-Droid as well, unless changes are made.

https://gitlab.com/fdroid/fdroiddata/-/issues/2441

jitpack/jitpack.io#4474

https://jitpack.io/docs/BUILDING/#java-version

Also in android studio stub files are loaded when opening class sources since android 12 sources aren't available.
@Canato
Copy link

Canato commented Sep 2, 2021

The solution is what @josejulio suggested.

You can check on SO too.

Create the jitpack.yml on your project root folder.

alanhu-dev pushed a commit to alanhu-dev/android-toolkit that referenced this issue Sep 5, 2021
@odbol
Copy link

odbol commented Oct 19, 2021

The sdkman solution in the documentation doesn't seem to work:

https://jitpack.io/com/github/google/tweakr/jitpack-v2.2.0-g66194de-3/build.log

Running before_install command:
sdk install java 11.0.10-open;sdk use java 11.0.10-open
/script/buildit.sh: line 41: sdk: command not found
/script/buildit.sh: line 41: sdk: command not found

@odbol
Copy link

odbol commented Oct 19, 2021

Neither does the jdk9 solution:

https://jitpack.io/com/github/google/tweakr/jitpack-v2.2.0-g150d9b1-4/build.log

> Failed to apply plugin 'com.android.internal.library'.
   > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.10.
     You can try some of the following options:
       - changing the IDE settings.
       - changing the JAVA_HOME environment variable.
       - changing `org.gradle.java.home` in `gradle.properties`.

@odbol
Copy link

odbol commented Oct 19, 2021

However, it looks like this yml config does work:

jdk:
  - openjdk11

@github-actions
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label May 27, 2022
@github-actions
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

AdamMickiewich pushed a commit to VolyaTeam/dzida-app that referenced this issue Aug 8, 2022
This reverts commit 296ee60

We do not need to bump to compileSdkVersion 31 currently, since I have decided not to bump `androidx.window` to `1.0.0-alpha10` or higher currently, since it has changed APIs and ViewUtils will break.

https://developer.android.com/jetpack/androidx/releases/window

Moreover, bumping compileSdkVersion to 31 requires openjdk 11 in build environment, which will break Jitpack library build and possibly still F-Droid as well, unless changes are made.

https://gitlab.com/fdroid/fdroiddata/-/issues/2441

jitpack/jitpack.io#4474

https://jitpack.io/docs/BUILDING/#java-version

Also in android studio stub files are loaded when opening class sources since android 12 sources aren't available.
shrihankp pushed a commit to reisxd/termux-app that referenced this issue Oct 20, 2022
This reverts commit 296ee60

We do not need to bump to compileSdkVersion 31 currently, since I have decided not to bump `androidx.window` to `1.0.0-alpha10` or higher currently, since it has changed APIs and ViewUtils will break.

https://developer.android.com/jetpack/androidx/releases/window

Moreover, bumping compileSdkVersion to 31 requires openjdk 11 in build environment, which will break Jitpack library build and possibly still F-Droid as well, unless changes are made.

https://gitlab.com/fdroid/fdroiddata/-/issues/2441

jitpack/jitpack.io#4474

https://jitpack.io/docs/BUILDING/#java-version

Also in android studio stub files are loaded when opening class sources since android 12 sources aren't available.
lucamtudor added a commit to theshiftstudio/compose-backstack that referenced this issue Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants