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. #4691

Closed
Lee-Wang-Jing opened this issue Aug 25, 2021 · 4 comments

Comments

@Lee-Wang-Jing
Copy link

Lee-Wang-Jing commented Aug 25, 2021

Found Android manifest
Android SDK version: 30. Build tools:
Installing Android platform 30
Found gradle
Gradle build script
Found gradle version: 7.0.2.
Using gradle wrapper
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Downloading https://services.gradle.org/distributions/gradle-7.0.2-all.zip
.
Unzipping /home/jitpack/.gradle/wrapper/dists/gradle-7.0.2-all/7era6s5ay7zsbhuvl0oc9g94s/gradle-7.0.2-all.zip to /home/jitpack/.gradle/wrapper/dists/gradle-7.0.2-all/7era6s5ay7zsbhuvl0oc9g94s
Set executable permissions for: /home/jitpack/.gradle/wrapper/dists/gradle-7.0.2-all/7era6s5ay7zsbhuvl0oc9g94s/gradle-7.0.2/bin/gradle


Gradle 7.0.2

Build time: 2021-05-14 12:02:31 UTC
Revision: 1ef1b260d39daacbf9357f9d8594a8a743e2152e

Kotlin: 1.4.31
Groovy: 3.0.7
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_252 (Private Build 25.252-b09)
OS: Linux 4.18.0-25-generic amd64

0m4.339s
Getting tasks: ./gradlew tasks --all
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2

FAILURE: Build failed with an exception.

  • Where:
    Build file '/home/jitpack/build/app/build.gradle' line: 1

  • What went wrong:
    A problem occurred evaluating project ':app'.

Failed to apply plugin 'com.android.internal.library'.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
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.

  • 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 18s
Tasks:

WARNING:
Gradle 'install' task not found. Please add the 'maven' or 'android-maven' plugin.
See the documentation and examples: https://jitpack.io/docs/

Adding maven plugin
Found android library build file in app
Running: ./gradlew clean -Pgroup=com.github.Lee-Wang-Jing -Pversion=3.0.0-withoutx5 install
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2

Configure project :
Gradle version Gradle 7.0.2

FAILURE: Build failed with an exception.

  • Where:
    Build file '/home/jitpack/build/app/build.gradle' line: 1

  • What went wrong:
    A problem occurred evaluating project ':app'.

Failed to apply plugin 'com.android.internal.library'.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
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.

  • 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1s
Build tool exit code: 0
Looking for artifacts...
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Looking for pom.xml in build directory and ~/.m2
2021-08-25T02:17:11.947898194Z
Exit code: 0

ERROR: No build artifacts found

@Lee-Wang-Jing Lee-Wang-Jing changed the title ndroid Gradle plugin requires Java 11 to run. You are currently using Java 1.8. Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. Aug 25, 2021
@kylecorry31
Copy link

I found that adding the following file to the root of my project resolves it: https://github.com/kylecorry31/Trail-Sense-Core/blob/main/jitpack.yml

@Canato
Copy link

Canato commented Sep 2, 2021

Duplicate of #4474
There is a solution on it, please use the same thread.

@Lee-Wang-Jing
Copy link
Author

Gradle 7.x
1、add jitpack.yml to root project
2、add apply plugin: 'maven-publish' to library project
reference link https://developer.android.com/studio/build/maven-publish-plugin
3、commit you code and add tag then build it

@Lee-Wang-Jing
Copy link
Author

Thanks @kylecorry31 @Canato

advmeds-service pushed a commit to advmeds-service/advmeds-device-management_lib that referenced this issue Oct 19, 2021
advmeds-service pushed a commit to advmeds-service/advmeds-device-management_lib that referenced this issue Oct 20, 2021
advmeds-service pushed a commit to advmeds-service/advmeds-device-management_lib that referenced this issue Oct 20, 2021
advmeds-service pushed a commit to advmeds-service/advmeds-device-management_lib that referenced this issue Oct 20, 2021
advmeds-service pushed a commit to advmeds-service/advmeds-device-management_lib that referenced this issue Oct 20, 2021
Java 1.8 to Java 11
update:
compileSdkVersion 31
buildToolsVersion "30.0.3"
targetSdkVersion 31

加入Fora MD6 引導文字與圖片
調整 jdk 版本為11
參閱
https://blog.csdn.net/qq_43596067/article/details/118859664
jitpack/jitpack.io#4691
https://www.gushiciku.cn/pl/ak4E/zh-tw
https://stackoverflow.com/questions/67599438/gradle-7-and-jitpack-io-runs-into-error-during-publish
advmeds-service pushed a commit to advmeds-service/advmeds-device-management_lib that referenced this issue Oct 20, 2021
Java 1.8 to Java 11
update:
compileSdkVersion 31
buildToolsVersion "30.0.3"
targetSdkVersion 31
fix:
Android 12 need setting android:exported="true"

加入Fora MD6 引導文字與圖片
調整 jdk 版本為11
參閱
https://blog.csdn.net/qq_43596067/article/details/118859664
jitpack/jitpack.io#4691
https://www.gushiciku.cn/pl/ak4E/zh-tw
https://stackoverflow.com/questions/67599438/gradle-7-and-jitpack-io-runs-into-error-during-publish
advmeds-service pushed a commit to advmeds-service/advmeds-device-management_lib that referenced this issue Oct 20, 2021
Java 1.8 to Java 11
update:
compileSdkVersion 31
buildToolsVersion "30.0.3"
targetSdkVersion 31
fix:
Android 12 need setting android:exported="true"
Add:
id 'maven-publish'
publishing {
    publications {
        mavenJava(MavenPublication) {
            groupId = 'org.gradle.sample'
            artifactId = 'library'
            version = '1.1'
        }
    }
}
加入Fora MD6 引導文字與圖片
調整 jdk 版本為11
參閱
https://stackoverflow.com/questions/68511986/how-to-solve-jitpack-error-no-build-artifacts-found
https://blog.csdn.net/qq_43596067/article/details/118859664
jitpack/jitpack.io#4691
https://www.gushiciku.cn/pl/ak4E/zh-tw
https://stackoverflow.com/questions/67599438/gradle-7-and-jitpack-io-runs-into-error-during-publish
advmeds-service pushed a commit to advmeds-service/advmeds-device-management_lib that referenced this issue Oct 20, 2021
Java 1.8 to Java 11
update:
compileSdkVersion 31
buildToolsVersion "30.0.3"
targetSdkVersion 31
fix:
Android 12 need setting android:exported="true"
Add:
id 'maven-publish'
publishing {
    publications {
        mavenJava(MavenPublication) {
            groupId = 'org.gradle.sample'
            artifactId = 'library'
            version = '1.1'
        }
    }
}
加入Fora MD6 引導文字與圖片
調整 jdk 版本為11
參閱
https://stackoverflow.com/questions/68511986/how-to-solve-jitpack-error-no-build-artifacts-found
https://blog.csdn.net/qq_43596067/article/details/118859664
jitpack/jitpack.io#4691
https://www.gushiciku.cn/pl/ak4E/zh-tw
https://stackoverflow.com/questions/67599438/gradle-7-and-jitpack-io-runs-into-error-during-publish
rafi0101 added a commit to rafi0101/Android-Room-Database-Backup that referenced this issue Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants