'Build Gradle Failed
I'm following Google Drive API instruction to upload file to google drive with java, when i try to "gradle run" in cmd, it announces that "BUILD FAILED" with "Could not target platform: 'Java SE 11' using tool chain: 'JDK 8 (1.8)'" I'm using java jre 1.8 and gradle 5.4.1 on Eclipse
Here is my build.gradle
apply plugin: 'java'
apply plugin: 'application'
mainClassName = 'DriveQuickstart'
sourceCompatibility = 11
targetCompatibility = 11
version = '1.0'
repositories {
mavenCentral()
}
dependencies {
implementation 'com.google.api-client:google-api-client:1.33.0'
implementation 'com.google.oauth-client:google-oauth-client-jetty:1.32.1'
implementation 'com.google.apis:google-api-services-drive:v3-rev20211107-1.32.1'
}
Solution 1:[1]
i change
sourceCompatibility = 11
targetCompatibility = 11
to
sourceCompatibility = 1.8
targetCompatibility = 1.8
and it worked, so it depends on your jdk version
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ?oàn Th? Phúc |
