ZXing-2.1 - Missing libraries - android

EDIT ::: For people who may be searching for a solution, Here it is.. (using ZXing 2.1)
Follow the steps below :::
First you have to import the existing code into your workspace
File -> import -> android -> existing android code into workspace
Browse to the unzipped folder of ZXing 2.1
You will have two projects in the list. Select both and click OK.
They will be imported into your workspace and you will have errors.
For the first Project (CaptureActivity in my case), you have to add the core.jar file present in ZXing2.1\zxing2.1\core
For the second project (ZXingTestActivity in my case), you have to add the core.jar file present in ZXing2.1\zxing2.1\core and android-integration.jar present in ZXing2.1\zxing2.1\android-integration
That's it.. You are done...
Hope this helps...
I have an application where we use ZXing. I have to update the library to the latest one. So I downloaded the code from ZXing-2.1.zip from here. When I try to compile I get errors in the import statements.
import com.google.zxing.BarcodeFormat;
import com.google.zxing.DecodeHintType;
import com.google.zxing.Result;
I couldn't find these libraries anywhere in the zip that I have downloaded. Can someone please guide me on how this is done? What am I doing wrong?
If you have a step by step tutorial, please do link them.

The classes are found in core.jar. You build this from the source code you downloaded.
I suggest you use the latest code from Subversion actually. If you do that, here's how you can get a pre-compiled JAR, or build one yourself: https://code.google.com/p/zxing/wiki/GettingStarted
(We are releasing 2.2 in a week or two by the way.)
Or if you want to build 2.1, see this previous documentation: https://code.google.com/p/zxing/source/browse/wiki/GettingStarted.wiki?spec=svn2659&r=2659

Extract zip
Right click on project-> properties-> Java Build Path-> Libraries-> Add External Jars-> select the jar file where it is in your Pc-> click ok.

Related

Import "MPChartLib" Library to Eclipse

I tried to add "MPAndroidChart" library in Eclipse but when I try to import this lib:(https://github.com/PhilJay/MPAndroidChart/archive/master.zip) .
Amongst the downloaded files , I found a folder called "MPChartLib". This is the actual library folder, I need to add this folder to my project to be able to use the full functionality of the library.
I tried to import the library folder into my workspace, using File-->Import-->Android-->Existing Android but I have this message " Select at least one project eclipse import" !!!!
The lib uses gradle, because of that you can't "import a eclipse project"
You have 2 options, install a gradle plugin for eclipse, or use the lib as a jar
From the lib README:
Download the latest .jar file from the releases section
Copy the mpandroidchartlibrary-.jar file into the libs folder of your Android application project
Start using the library
I hope the same named file is already there or else you can do one thing check the file name to the New Project Name column and check the same file name in your workspace. I must say you that the same named file is definitely there.
So once you will find this, just rename your file name into your workspace and try again importing this.
I hope this will work for you. Any help will be needed, do let me know.
"Select at least one project eclipse import" this message inform you that you have already added Lib in Work Space check for already added "MPChartLib" Lib followed this step:-
Write click on your project and select Properties.
On left select Android.
In Android->Library section click Add
Select for "MPChartLib" (note: name can be change).
Or If you unable to find lib please make new workspace if possible then import MPAndroidChart on workspace.

How to add library project to an existing android project in AndroidStudio

how can I add a custom library project (in my example the CuXtomCam library) to an existing android project using Android Studio 1.1?
I've read about changing the build.gradle file. But where should I place the library ressources?
Thank you in advance for all answers and comments!
To import library into Android Studio:
select File > Import, and then select the directory containing the project to import.
a wizard will open and guide you through the rest of the import process.
When the project import has finished, it will open up a file called "import-summary.txt" which lists all the steps taken during import and suggestions for next steps. For example, it may note files that were not migrated, it may note missing components in your SDK install, and so on.
Just right click on the project then New>Module. from the new window select Import existing project. Give the directory. I think this will help

Android: I am unable to import a project into my workspace

https://github.com/JakeWharton/Android-ViewPagerIndicator
I'm trying to include that library/project into my workspace, however nothing shows up when I choose the folder to import. I have no clue what I'm doing wrong as I use the same method to import other sample projects. There must be something different about this project.
Could someone try it out?
File->New-> Android Project
select Create project from existing source
Browse...->JakeWharton-Android-ViewPagerIndicator\library
Finish
if any errors in project exist,try next:
go to libs folder in eclipse Package Explorer
right click on android-support-v4.jar
Build Path -> Add to build path

Not able to import the another project as a library?

I am going to licensing my Application. I know all the process for licensing application.
But for that I have to load the Library Project in My Workspace.
I have loaded the Library Project in my WorkSpace then i have imported it into my Original project. It works great.
But now the problem is, If i have once deleted that library project and then if i have imported into workspace from another location and if i import it in to my that project then it is not going to import it.
And if i Import it from the previour one location, then its again works fine. . .
So why it is happening like that?
Why i am not able to import the library project from any location?
Please guide me for this.
Thanks.
I dont know why it is happend. But if you have import once from any location. and then delete it.
Now if you are imported the same project from another location than it is also not going to imported.
For sollution you have to Put that library project at once place for which you what it every time.
And if necessary then do not delete that library project after Importing it to the Original Project.
Thanks.
If you want to include a project to your current project follow the steps,
1.) Right Click(or Alt+Enter) on the project_as_library->Library-> check mark Is Library
2.) Right Click(or Alt+Enter) on the project where you want to include the Library, go to Android->Library->Add. When you click Add you will see the Project name that you declared as Library, selected that and Press Ok and you are done.
From your question, i am assuming that you want to import any library into your project and if you want to use any library(.jar) then you can do these steps:
create "libs" folder inside your application's structure, at same level of "src" directory.
Now copy those libraries into this libs folder.
Right click on any librarary -> Build Path -> Add to Build Path.
Update:
As you have commented below as its library project, i would suggest you to go through this Android doc on Setting up a Library Project

Android libraries not found

In my android project I am writing a program to connect to a server and below are the libraries that I need to use.
But I get an error saying the following cannot be resolved. How to resolve this error? I am using eclipse JAVA EE on Windows.
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.ContentBody;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.entity.mime.content.StringBody;
Add these two dependency
compile "org.apache.httpcomponents:httpcore:4.2.4"
compile "org.apache.httpcomponents:httpmime:4.3"
It will work.
Download the jars from the apache commons site and add them to project and path.
[Edit] now in Apache HttpComponents http://hc.apache.org/downloads.cgi
I know this is an old thread but it make be worth mentioning that these jars are now included in the eclipse Android ADT bundle (for MAC anyway, I have not checked for Windows). You do need to check the version is the one you want, but if it is you are good to go.
This means you can add them to your project without having to download them separately first - just follow these steps:
First right click your project and select properties as shown below:
Then select Java Build Path from the pop up window:
and now select the 'Libraries' tab:
and click on 'Add external JARS' and navigate to your ADT bundle/sdk/tools/lib/httpclient (httpmime etc), and then just click open:
You also need to import the Jar file itself into your project. I found the best way to do this was to simply copy the JAR files into the 'libs' folder in your project - i.e. CTRL C and CTRL V, or normal drag and drop file copy. To be safe I would refresh (right click project and select refresh - see menu in first picture above) and then clean your project.
Note if you do the Build Path part above correctly but forget to add the JAR files themselves into your 'libs' folder, you will get an error like:
'Caused by: java.lang.NoClassDefFoundError: org.apache.http.entity.mime.content.FileBody'.
To resolve this just copy the jar files into the 'libs' folder in your project.
You should now be good to go!
download the jar from here : http://commons.apache.org/
install it in your project like this:
Right click on your project and go to properties.
On the left tab go to "java build path". And in that on right go to libraries.
Click on add external jars and give the path of the jar and your library is added.
try to download it from HttpClient Downloads
Download the JAR file "httpmime-4.0-beta2.jar" and add it to your project
If you are using android studio add the following import to your code:
import org.apache.http.entity.mime.content.FileBody;
The IDE will give you an error under "mime" and ask you if you would like to install the dependancy. So if you say yes it will search for it online and then you can download it to app/build/libs directory.
FileBody will then be recognized after this process is complete.
Add
compile files('libs/httpcore-4.3.2.jar')
compile files('libs/httpmime-4.3.4.jar')
to your build.gradle.
Before that download .jar from
http://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore/
http://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime
and to your apps>lib folder.

Categories

Resources