I have google about it online but didn't help and here I am posting my question. I have eclipse version platform version=3.8 which I downloaded from https://developer.android.com to create a android application. Now when I declare a arraylist <> in my program it doesn't recognize it. I read few questions here saying you need to have a version Eclipse version >= 3.1 to be able to increase Java compiler over 1.7. But now my question is when I already have 3.8 why the Java Compiler options are not showing above > 1.7 for me to select. Is android project and eclipse java project a separate thing? I opened eclipse and created this android application project. Appreciate your time and help.
Asked
Active
Viewed 438 times
0
-
Have you told Eclipse to use a Java 7 JRE and compatibility? Window > Preferences > Java > Installed JREs is one place to look. – Steven Hood Apr 08 '13 at 05:14
-
It only shows 1.7, I read that for me to use
in my android application project as private ArrayList – arun thakur Apr 08 '13 at 05:23List1; I need to have JDK level to >= 5.0 : http://stackoverflow.com/questions/1290920/syntax-error-on-arraylist-declaration
1 Answers
0
You forgot to use new
.
Android application should use java 1.5 or 1.6.
Android is not supporting 1.7.ArrayList<object> abcd= new ArrayList<object>();
And if you want to use java 1.7 in Java application project. Java 1.7 should be installed in your PC.
my guess would be that while you run eclipse itself with jdk 1.6, it's actually configured with a different default jre. see window->preferences->java->Installed JREs and make sure that the checked JRE is 1.6.
if the default JRE is indeed 1.6, chances are that it's a project specific setting. see that the project is configured to use the right jre.

Vishal Vijay
- 2,518
- 2
- 23
- 45
-
So Android cannot support > 1.7? and that means I cannot use private ArrayList
List1; in android application project? Thanks for the response. – arun thakur Apr 08 '13 at 05:21 -
`ArrayList
abc= ArrayList – Paresh Mayani Apr 08 '13 at 05:22();` is correct syntax and we can use it. Who said we can't use? -
I am unable to use private ArrayList
List1; in Android project and it says – arun thakur Apr 08 '13 at 05:29cannot be recognized. I am using ADT Build 21.1.0 and Eclipse 3.8 and JDK compiler for the Project -> Properties -> Java Compiler -> Compiler Compliance Level only shows until 1.7 to select. Here is what I am following : http://stackoverflow.com/questions/1290920/syntax-error-on-arraylist-declaration -
-
-
-
See this link. it may help you http://stackoverflow.com/questions/7637144/android-requires-compiler-compliance-level-5-0-or-6-0-found-1-7-instead-plea – Vishal Vijay Apr 08 '13 at 05:39
-
-
Well thats exactly the issue is,
cannot be resolved if I use above in android application as it is using JDK 1.6 or so. Article: http://stackoverflow.com/questions/1290920/syntax-error-on-arraylist-declaration says I need to have Eclipse > 3.1 but i already have Eclipse 3.8 and Android developer tool version shows V21.0 – arun thakur Apr 08 '13 at 05:42 -
-
Can I declare a arraylist like this ? private ArrayList
MyArrayList; in android project? I am getting an error abc cannot be resolved. If I try above statement from comment above I get error: object cannot be resolved to a type – arun thakur Apr 10 '13 at 05:17 -
Tell me ,What is abc here.? It should be class name. (It should be an Object type) – Vishal Vijay Apr 10 '13 at 10:35