1

I am getting Android compiler error like:

Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.

I am using JDK 1.7. So I changed it to 1.6/1.6.

When I fix it, I get this error:

Multi-catching exception. You need to change it to 1.7. Multi-catch parameters are not allowed for source level below 1.7.

How do I solve this? I want to use multi-catch exceptions...

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • 1
    Multi casting exception? What is the exact wording of that message? – Alex Gittemeier Dec 05 '13 at 06:23
  • Check your environment variables, java_home and path variables are set to java 1.6 or 1.7. – AndroidDev Dec 05 '13 at 06:23
  • 2
    Thanks for the comment sir but I am using 1.7 with path settings and I am on java work with android using in eclipse,.. so that eclipse cannot open unless you set the path,.... –  Dec 05 '13 at 06:33
  • 2
    Alex sir,.. This is the Message sir,.."Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties." so when I fix it( I changed it to 1.5/1.6) I am getting this error "Multi-catch parameters are not allowed for source level below 1.7" –  Dec 05 '13 at 06:35

1 Answers1

2

You want to use multi-catch with Java 1.6; you cannot, because it was added in Java 1.7.

To change the multi-catch blocks you'll need to change every catch of this form (the multi-catch form) -

} catch(ParseException | IOException exception) {
}

to this form (e.g. standard catch blocks)

} catch (ParseException exception) {
  // do something.
} catch (IOException exception) {
  // do something (else?).
}
Elliott Frisch
  • 198,278
  • 20
  • 158
  • 249
  • 3
    hello sir,.. Thank for the Response if I use multi catch with 1.7 I am getting "Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties." error is there any procedure for this –  Dec 05 '13 at 06:30
  • [Switch](http://stackoverflow.com/questions/7637144/android-requires-compiler-compliance-level-5-0-or-6-0-found-1-7-instead-plea) your compiler compliance level down to 1.6 (or 1.5), and then change your multi-catch(s) to regular catch block(s). – Elliott Frisch Dec 05 '13 at 06:32
  • 3
    hello sir how to change multi casts to regular casts –  Dec 05 '13 at 06:37