8

I'm trying to use java version 1.7 with android studio but unfortunately it is not working properly... If set the version in File->Other settings -> Default project structure to

  Project SDK:
  java version 1.7.0_06

  Project language level:
  7.0 Diamonds, ARM, multi-catch

But when I use a switch-statement with a string I get an error which should be possible in java 1.7, so do I need to set any other settings?

wasp256
  • 5,943
  • 12
  • 72
  • 119
  • See also: http://stackoverflow.com/questions/17637179/how-to-set-source-1-7-in-android-studio-and-gradle – arober11 Aug 02 '14 at 17:02

3 Answers3

10

No... there is no settings to change. Android SDK don't support full java 7 syntax, so you can't use it.

Note that java.nio.* (new in java 7 API) is supported by latest android version.

ben75
  • 29,217
  • 10
  • 88
  • 134
9

You can change it in new Android studio version(0.8.X)

FIle-> Other Settings -> Default Settings -> Compiler (Expand it by clicking left arrow) -> Java Compiler -> You can change the Project bytecode version here

enter image description here

San
  • 5,567
  • 2
  • 26
  • 28
1

You can change jdk version from File > Other settings > Default Project structure. Then JDK location:

enter image description here

shantanu
  • 2,408
  • 2
  • 26
  • 56