1

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

I have added this line of code to my android app:

ArrayList<hashmap<string, string="">> mylist = new ArrayList<hashmap<string, string="">>();

it has worked in other peoples apps but on mine it comes up with a red cross next to is which when I hover over it says:

Multiple markers at this line
- Syntax error on token ">>", invalid AssignmentOperator
- Syntax error on token ",", TypeArgument2 expected after this token
- Syntax error on tokens, delete these tokens

I also have a error displayed on the console:

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

I have tried:

project -> android tools -> fix project properties,

project -> clean,

project -> properties -> java compiler -> compiler compliance level (currently set at 1.5 but have tried 1.6 and 1.7 and no fix)

Please help :(

Community
  • 1
  • 1
Paul
  • 2,465
  • 8
  • 35
  • 60
  • 4
    I find it impossible to believe it worked anywhere; that line is wrong on multiple levels. – Dave Newton Jun 05 '12 at 17:36
  • I'm afraid I would have to disagree with you on that, there are many people using this code, and I actually have a validated project with it in, I just can't get it to work in my current project. – Paul Jun 05 '12 at 18:29
  • Unless you have your own classes named `hashmap` and `string` (which is a horrible idea) and your own Java parser or it's not Java 1.5/1.6, no you don't. Put a minimal working project containing that up on github and describe the complete environment in which it lives. – Dave Newton Jun 05 '12 at 18:33
  • Finally got it to work! Had to set the compiler to 1.5 and restart my computer for some reason. But working now. Thanks for all input :) – Paul Jun 05 '12 at 18:36
  • for beginners: note that the Fix Project Properties is found with a right-click on the project name in Android Tools. – Martin Jan 05 '13 at 20:12

1 Answers1

5

First ,You Should Read Java Collections And Generics

ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String,String>>();

and set Compliance level 1.6, because 1.7 is not compatable yet. Java 1.5 gives @Override anotation error. Because @Override introduced in 1.6.

project -> properties -> java compiler -> compiler compliance level->Set it at 1.6 
Samir Mangroliya
  • 39,918
  • 16
  • 117
  • 134