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.
Android Studio 1.5 MacOSX Yosemite 10.10.5
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"
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 **.
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
.
In other words
The latest version combinations that can be built with Java6
Gradle 2.14.1
Gradle build tools 2.1.3
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'
}
}
(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'
}
}
}
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).
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