apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
}
dataBinding {
enabled = true
}
}
這是我的build.gradle.It在Android Studio中編譯成功。 但是當我在./gradlew build
終端上運行。 這是構建錯誤。 錯誤:Android項目構建錯誤:不支持major.minor版本52.0
What went wrong:
A problem occurred evaluating project ':app'.
java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Java的版本
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
./gradlew -v
------------------------------------------------------------
Gradle 2.14.1
------------------------------------------------------------
Build time: 2016-07-18 06:38:37 UTC
Revision: d9e2113d9fb05a5caabba61798bdb8dfdca83719
Groovy: 2.4.4
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.7.0_71 (Oracle Corporation 24.71-b01)
OS: Mac OS X 10.11.4 x86_64
[如何修復java.lang.UnsupportedClassVersionError:Unsupported major.minor版本](http://stackoverflow.com/questions/10382929/how-to-fix-java-lang-unsupportedclassversionerror-unsupported-major -minor-versi) –