build library ZXing for android project - android

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.

Related

Facebook SDK 4.x errors with JDK 1.7 in Eclipse

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>();

Android samples - Accelerometer and APIDemos do not build

I am new to Android development. I have succesfully installed eclipse with Android Developer Tool plugin and many of the samples work fine.
But Android samples - Accelerometer and APIDemos do not build. I see many build errors notifying to fix the errors in code. I dont think Google has released APIDemo sample with build errors.
Thanks in advance, please advice how to fix these errors, or if any configuration/setting is required.
I have set the Java compiler compliance level to 1.6.
Error information(for acceralometer sample):
The project contains error(s) in application. Please fix them before running
Error details:
The method onAccuracyChanged(Sensor, int) of type AccelerometerPlayActivity.SimulationView must override a superclass method
AccelerometerPlayActivity.java /AccelerometerPlay/src/com/example/android/accelerometerplay line 456
Java Problem
Call requires API level 8 (current min is 5):
android.view.Display#getRotation AccelerometerPlayActivity.java /AccelerometerPlay/src/com/example/android/accelerometerplay
line 389 Android Lint Problem
Regards,
Jai
Look for the line androidminSdkVersion ="5" in your android.manifest file
and change its value from 5 to 8 or anything more than 8
Alternative is
Go to project properties by right clicking on you project,
thereafter look for Android in properties.
You have to select the build target here equivalent to the api for which it the sample project is build for
Refer Image
Say if you are using the sample from folder android-12 then you have to check the same option(ie API Level 12) here in properties
A possible reason can be a slow PC, which does not build in time. Then errors occur due to absence of R.java
In that case (errors are with something like R.id.stuff), build the project and wait.
I found the fix myself!
Earlier I tried with Andriod version 4.0. Now I just tried ApiDemos sample with Android version 4.1.2. It worked fine. I also deployed the apk in my mobile. It just works fine.

Android Import incorrectly includes min SDK JARs instead of target

Hopefully I am not missing something obvious. I have done a good bit of work to isolate this issue. Say I create a new Android project:
Target Platform: Google APIs Android 3.1 (API 12)
Min Platform: Android 2.2 Froyo (API 8)
When the project is created, AndroidManifest.xml shows min=8, target=15 (not sure why 15 and not 12 actually, but that's not the issue). And this looks fine:
included JAR: Google APIs [Android 3.1]
project.properties shows target=Google Inc.:Google APIs:12
So far, so good.
Now, without even editing the fresh project, I remove that project from the workspace, move it somewhere, and import using Import->Android->Existing Android Code into Workspace.
Now:
Included JAR: Android 2.2
project.properties shows target=android-8
And the project now has errors due to things like the Holo style not being present in 2.2.
I tried Project->Clean, nothing. I tried Android->Fix Project Properties. No change.
The only fix is to remove the project, delete the project.properties, update the AndroidManifest.xml to use min-sdk 12, and re-import. Even, then, I don't get the Google JAR:
Included JAR: Android 3.1
project.properties shows target=android-12
It seems like the import process incorrectly uses the min SDK value instead of the target when creating the project. Or is this somehow expected behavior? What am I missing?
(This scenario may seem a bit contrived, but I am an instructor trying to import student assignments. So this is causing me difficulties!)
Right click the imported project and go to
Properties - Android - Project Build Target
Specify the build target as the target sdk version.
Now it should include the correct jar file.
Hope this helps

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)

ActionBarSherlock not working in eclipse

I have been trying to get ActionBarSherlock ( http://www.actionbarsherlock.com ) working with my eclipse projects. I added ABS into a new project with target version 3.2, and this created fine. When I try to add this as a library to my other project (min version 2.1, target 3.2), I get errors such as
G:\EclipseWorkspace\Android\ActionBarSherlock2\res\values-v11\abs__styles.xml:65: error: Error: No resource found that matches the given name: attr 'android:windowActionModeOverlay'
basically, none of the xml attributes found in 3.0 or higher are recognised. As a consequence, R.java does not generate.
Am I doing anything wrong?
You need to compile with Android 3.2 in addition to targeting at least API 11 both in your app and for the library.
In eclipse, right click on the project and go to "Properties". Under the "Android" tab you'll need to select Android 3.2.
Eclipse is giving me strange Errors too, when implementing external libraries. What always helped for me after some tries:
try multiple times:
*rightclick on your project => Source => Clean Up
*delete and readd the library project
*restart eclipse several
you might also try to delete the generated files to force it to regenerate, but do this on your own risk :)
have fun w/ the open source libraries :)
Try upgrading the version of the sdk and target version 2.1:
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/>
This will allow using last sdk features and the app will work on version 2.1.
Maybe, you'll see issues even after fixing this. Then you can clean the project.

Categories

Resources