MAC 解决Unsupported major.minor version 52.0问题
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/4wei.cn/work/Lab/panda.android/PandaAndroidDemo/build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':PandaAndroidDemo'.
> 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
目前看,是因为mac上存在多个java版本时调用了低版本的java,或者java版本过低,解决办法是进行mac中不同jdk版本切换
查看默认java版本
javac -version
修改为使用Android Studio中带的java版本不用再重新下载新的jdk了
cat ~/.bash_profile
export ANDROID_HOME=~/Library/Android/sdk
export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"
export PATH=$PATH:$JAVA_HOME:$ANDROID_HOME
然后重启终端,再查看java版本
javac -version
javac 1.8.0_112-release