When building an Android application, which Java version should I compile the code for? I'd guess this depends on the minSdkVersion
? And if so, where can I find the required Java version for each minSdkVersion
?
And once I determine the Java version I want, how do I set it? I build my project using Ant (from the command line). Currently it seems to always use 1.5 because the build.xml
file imports ${sdk.dir}/tools/ant/build.xml
which contains:
<property name="java.target" value="1.5" />
<property name="java.source" value="1.5" />
...
<javac ... source="${java.source}" target="${java.target}" ... >
Should I change it there? Is there a way to set it per project?
And is there a way to set the Java version if I build using Eclipse?