Android Studio: what compiler settings when including Google Maps

瘦欲@ 提交于 2019-11-29 09:19:56

"Major version" means Java version. Java 7 = 51, Java 6 = 50. The code is written for Java 7, and that is something that Android's dex supports. I am not sure what you are building with that is not set for Java 7, but that's the problem. The Maven build in the project works correctly. I don't see the error you mention, and it may be related to Java 6 vs 7 too.

Christopher Pickslay

I was able to resolve this based on Jason Hocker's tip and this answer. Add this to your android gradle task:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

Note that you must have a Java 7 JDK installed. I also had to add this to my gradlew to allow gradle to find the correct JDK:

export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!