简体   繁体   English

使用JDK 1.7编译Android项目

[英]Compiling Android project with JDK 1.7

My Android project is set up to use Maven, so I imported into IntelliJ from the pom.xml file. 我的Android项目设置为使用Maven,因此我从pom.xml文件导入了IntelliJ。 The compiler settings in IntelliJ are correctly pointing to 1.7, but when I try to compile I get: IntelliJ中的编译器设置正确指向1.7,但是当我尝试编译时,我得到:

Error: java: javacTask: source release 1.7 requires target release 1.7 错误:java:javacTask:源版本1.7需要目标版本1.7

My settings for the maven compiler plugin has both source and target set to this, so that's not the problem. 我为maven编译器插件设置的源和目标都设置为此,所以这不是问题。 However, in the module settings I see that my module is using 但是,在模块设置中,我看到我的模块正在使用

Maven Android API 19 Platform (java version "1.6.0_37") Maven Android API 19平台(Java版本“ 1.6.0_37”)

If I try changing this manually in IntelliJ when I open my project after closing it it gets set back. 如果在关闭项目后打开项目时尝试在IntelliJ中手动更改此设置,则它将重新设置。 I think that it has something to do with the android-maven-plugin , but I don't see where to force it to use java 1.7. 我认为这与android-maven-plugin有关 ,但我看不到在哪里强制它使用Java 1.7。

There is nothing in the Android Maven Plugin that forces Java 6. It must have to do IntelliJ and its Maven integration somehow. Android Maven插件中没有强制Java 6的东西。它必须以某种方式执行IntelliJ及其Maven集成。 Or some other related configuration. 或其他一些相关的配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM