Facebook SDK 4.x errors with JDK 1.7 in Eclipse - android

I'm trying to use the latest Facebook SDK (4.2 as of today) in an Android project, and I'm using Eclipse (if I'm not mistaken, this version no longer includes an Eclipse project so I had to create one with the included files).
I'm getting the following error message:
[FacebookSDK] Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.
Doing Fix Project Properties does nothing. However, when I manually set the project to use 1.6, I get the following error:
'< >' operator is not allowed for source level below 1.7
Any tips on how to fix this?
Thanks

In case this helps anyone, what I did was what's mentioned in this answer:
How to fix '<>' operator is not allowed for source level below 1.7 in 1.6?
Specifically, I left the version as 1.6 and simply entered the class type that is expected in the <>.
So for example, instead of
ArrayList<ModeHandler> handlers = new ArrayList<>();
I would simply enter the class:
ArrayList<ModeHandler> handlers = new ArrayList<ModeHandler>();

Related

build library ZXing for android project

hi i want to make QR code scanner to my android app using ZXing library
i already success try it with "Scanning via Intent" method before
now i try different approach
my problem is i always get this error
my step
1. download zxing master from here
2. download jar from repository here
3. import ‘android’ folder from zxing-master in eclipse
4. create libs folder and copy core.jar in there
5. right click in CaptureActivity - properties - java build path - library tab - add core.jar path
i don't know why i still get error after add jar path...
i already try clean project, swith workspace, using latest jar file but still same
any idea?
#update #Nickolai Astashonok
eclipse error
'<>' operator is not allowed for source level below 1.7
i try to change java compiler using 1.7 (default 1.6) by
right click project - properties - java compiler tab
but it's seem my target API not fullfil requirment (my API 15)
how to use ZXing in java compiler 1.6?
Update #Sean Owen
when i changed using java compiler level 1.7 and clean project it's says
Using 1.7 requires compiling with Android 4.4 (KitKat); currently using API 15
i wanna target my aplication runs for ICS (API 15)
i'm not sure if in 'captureActivity androidManifest using minSDK 19' and 'myProject androidManifest using minSDK 15 will be running well
so i guess i better stick with java compiler 1.6
meanwhile i found this link
based on that link i need to use zxing library version 4.5.1 (java compiler 1.6)
because version above using java compiler 1.7
but i can't find any download link to 'zxing library version 4.5.1'
Your question is not clear, but I think the answer is this: the source code indeed requires Java 7. You simply need to set your IDE project to use Java 7. The supplied Maven build already works correctly in this regard. It is not true that API 15 or any other Android API needs Java 6.
I found 4.5.1 but I don't know how to download it! if you figured it out let me know too please.
https://code.google.com/p/zxing/source/browse/?r=2927#svn%2Ftrunk%2Fandroid
I got the same issue and I solve this by doing:
change the java compiler to 1.7 (like what Nickolai Astashonok suggested)
change the target version to 19 (Android 4.4)
Clean the project again, you will see lots of errors removed but there is still some errors related to missing of CameraConfigurationUtils.java
Please go to below link to download and copy the file into your project as per the path suggested.
https://github.com/zxing/zxing/blob/master/android-core/src/main/java/com/google/zxing/client/android/camera/CameraConfigurationUtils.java
Clean the project again, you should be able to clear all the errors and use the sample application in the 'android' folder.

Error in using binary literals number. Why should i use old JDK?

I am new programmer in android and java. I want to write a program that use binary literal number, and i see an error, Binary literal can only be used with source level 1.7 or greater. When i double clicked on the error in Eclipse, this error removed and another error appear in the problems tab!!! new error is Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties. When i Click on the Fix Project Properties old error again appear!! I confused. I searched in the internet and stackoverflow and i found this link but now i don't know why should i use old JDK? Can't supported anything with Java7?
Thanks for help. Cheers
Android does not support java 7 and hence you need to be on lower version. Check under the system requirements here:
http://developer.android.com/sdk/index.html
Sad but you cannot use the feature of java 7 in android and hence the eclipse does not allow so.

ActionBarSherlock Omnibus v3.8

I tried to import ActionBarSherlock in sub folder external of omnibus v3.8 but I got so many errors (more than 150). Most of them are about override a super class method.
If I remove #Override annotation at the error line, the error is gone. Should I remove it one by one (more than 150 error) ? Is there any shortcut way to remove all errors?
The release of ADT plugin : 18.0.0
JDK : 1.7
Build target : 15
Thanks
The source code that you imported is from http://github.com/commonsware/cw-omnibus. If you read that Web page, you will find instructions for use of that code. If you read those instructions, you will find that:
You need to have your Java compliance level set to 1.6 and
You may need to adjust the ActionBarSherlock project to build with a build target that you have installed, or to install API Level 14 (which, IIRC, is what ActionBarSherlock wants)

android- How to run the program when i am getting error

Running the application in the Eclipse i am getting the following error.How to handle that.
[2011-06-29 10:35:46 - Roadbrake] Android requires .class compatibility set to 5.0. Please fix project properties.
thanks
this kind of error will ganrate when u use the android version which is support the JDK is not match in your computer
for that
trace the path in eclipse :: project>>property>>java Compiler .. set the JDK 1.6
Under project properties (select project, then Alt+Enter).
Find Java Compiler, and change the Compiler compliance level:

Bug with Override annotations in Eclipse

I have a annoying problem with #Override annotations in Eclipse. Often when i import working projects on a new PC, Eclipse marks some of the #Override annotations as wrong. If i remove the annotations everything is fine and Eclipse also indicates that the methods are overriding the parents methods but adding the Override annotation causes the error again. I am currently working on an Android project so it might be a problem with Android and not with Eclipse..
This is most likely because you are switching between Java 1.5 and Java 1.6. In 1.5 you couldn't mark interface implementations with #Override, but you can in 1.6.
A quick Google search turned up this good explanation of the difference in this annotation between the two versions: http://www.techienuggets.com/CommentDetail?tx=38155
Semantics of #Override is different in
JDK 1.5 and JDK 1.6. In JDK 1.5, the
#Override annotation is not allowed
for implementations of methods
declared in an interface, while they
are allowed in JDK 1.6. For more
information, see:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5008260
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6399361
http://blogs.oracle.com/ahe/?entry=override
It is fact that the description of the
Override annotation was not updated
in the JDK API docs. This has been
reported as a bug:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6501053bugdatabase/view_bug.do?bug_id=6501053
just go to
window -> prefrences -> java -> compiler
and set it to 1.6 as notation starts from 1.6 so if compilence level will less then 1.6 it will gives error
There are a few places where Java Compiler settings are configured.
One way is to Window->Preferences->Java->Compiler->Compiler Compliance Level -> set 1.6 or above.
Another way is right click on the Project->Properties->Java Compiler->JDK Compliance -> Select 1.6 or above.
Also You can unselect "Enable Project Specific Settings" , this will eliminate future JDK compiler compliance errors.
Remove Multiple instances of JDK Versions , unless different projects need them.
Make sure the used Java SDK is up to date and that eclipse use the right SDK version (if you have more than one installed) and treats your Android project with the right SDK version...

Categories

Resources