You are currently using Java 6. Solution in Android Studio Gradle

What happened

Error when trying to open old project and build Gradle in Android Studio

Error:Gradle 3.3 requires Java 7 or later to run. You are currently using Java 6.

JDK 1.8 (8) is already installed and the project's JDK settings are also set. However, the error above does not disappear.

environment

Android Studio 1.5 MacOSX Yosemite 10.10.5

What I tried

The Mac has JDK 1.8 (8), and the environment variable JAVA_HOME is also specified in the path of JDK 1.8. (I also tried rebooting)

But I couldn't get the error.

If you try to raise the version of Gradle,

Error:Failed to complete Gradle execution.

Cause:
Received fatal alert: protocol_version

It seems that it can be solved with the following options when Java is executed Not passing. JAVA_TOOL_OPTIONS="-Dhttps.protocols=TLSv1.2"

solution

Or rather a workaround.

If you upgrade the version of Gradle, as the title suggests, Java 6 will not work. So, ** lower the version to the limit where the build can pass with Java6 **.

Run on Java6

Gradle and Android Studio plugin Gradle build tools Seems to be involved

If you try, what you can do with Java6 is It seems to be up to Gradle 2.x series (<= Gradle 2.14.1), The version of Gradle build tools that can run Gradle 2.14.1 is = <Gradle 2.1.3.

Gradle build environment with Java6

In other words The latest version combinations that can be built with Java6 Gradle 2.14.1 Gradle build tools 2.1.3

Lower the Gradle version of your project

Running ./gradlew in the Project root directory

python


$ chmod 755 gradlew
$ ./gradlew tasks
...
FAILURE: Build failed with an exception.

* Where:
Build file '/Users/user/AndroidStudio1.5Projects/RepeatingLocalNotifications/app/build.gradle' line: 1

* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
   > Gradle version 2.14 is required. Current version is 3.3. If using the gradle wrapper, try editing the distributionUrl in /Users/user/AndroidStudio1.5Projects/RepeatingLocalNotifications/gradle/wrapper/gradle-wrapper.properties to gradle-2.2-all.zip

Gradle 2.14 is required. Actually 2.14. + passes.

bash:./gradle/wrapper/gradle-wrapper.properties


#Changed to
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

java:./app/build.gradle



buildscript {
    ...
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.3'
    }
}

Add repository

(It has nothing to do with Java6, but because it is a dependent library, it will be built through.)

java:./build.gradle



allprojects {
    repositories {
        ...
        maven {
            url 'https://maven.google.com'
        }
    }
}

Conclusion

I went through. (Although it is not a fundamental measure.) Due to the environment of the old Mac (Yosemite 10.10.5), there may be a problem with the internal library (Xcode build tools).

reference

https://stackoverflow.com/questions/51090914/received-fatal-alert-protocol-version-build-failure-gradle-maven

https://stackoverflow.com/questions/43133857/gradle-3-3-error-need-java-7-or-later-unsolved

https://stackoverflow.com/questions/45989687/gradle-3-3-requires-java-7-or-later-to-run-you-are-currently-using-java-6

https://stackoverflow.com/questions/52535842/gradle-4-10-2-requires-java-7-or-later-to-run-you-are-currently-using-java-6-wh

Recommended Posts

You are currently using Java 6. Solution in Android Studio Gradle
When you want to implement Java library testing in Spock with multi-module in Gradle in Android Studio 3
Java to C and C to Java in Android Studio
Impressions and doubts about using java for the first time in Android Studio
Notes in Android studio
Java in Visual Studio Code
Using Docker from Java Gradle
In Java 10, when you do gradle eclipse and JavaSE-1.10 comes out, ...
The problem that XML attributes are sorted arbitrarily in Android Studio
Source to display character array with numberPicker in Android studio (Java)
[Android] Convert Map to JSON using GSON in Kotlin and Java
Is the version of Elasticsearch you are using compatible with Java 11?
Determining if a custom keyboard is enabled in Android Studio (Java)
Try implementing Android Hilt in Java
Do HelloWorld in Java / IntelliJ / Gradle
Encrypt using RSA cryptography in Java
Automatically insert `@SuppressWarnings` in Android Studio
OkHttp3 (GET, POST) in Android Studio
[Android Studio] [Java] Learning memos & links
HTTPS connection using tls1.2 in Java 6
I tried using JWT in Java
Reintroducing Java 8 available from Android Studio 2.4
Do you use Stream in Java?
Hello world in Java and Gradle
[Java] Where did you try using java?
Creating a project (and GitHub repository) using Java and Gradle in IntelliJ IDEA
[Android Studio] Description that can be continuously input in SQLite Database [Java]
If you get angry with java.lang.UnsupportedClassVersionError: com / android / build / gradle / AppPlugin: Unsupported major.minor version 52.0 in built gradle after Android Studio 2.3
Make an executable jar using Android Studio
I tried using Elasticsearch API in Java
Try using the Stream API in Java
Map without using an array in java
Using JavaScript from Java in Rhino 2021 version
ERRORCODE = -4471 occurs in Java application using Db2.
Try using JSON format API in Java
Generate DB documentation using SchemaSpy in Gradle
Screen transition by [Android Studio] [Java] button
[Mac] Install Java in Visual Studio Code
How to use ExpandableListView in Android Studio
If you are using Android Room and want to change the column definition
Android Studio memo that you want to display Toast characters in large size
I stumbled on the Java version in Android Studio, so I will summarize it