Including External Library in Android project - android

I am new to android I thought of using this Opensource library but I don't know how to download it and include it in my project since there is not .jar file.

Set the library up as an Android library:
Right-click on the library project
Select Properties
Go to the Android tab
Mark the project as the library
Then set your application to use the library:
Right-click on the library project
Select Properties
Go to the Android tab
Add a library at the bottom
That way, you will now be using the library when working on your app.

Related

Android Studio 0.8.2 : How to add local Project Library?

i am a android app developer and converting myself from Eclipse to Android Studio.
Now i get a difficulty to add library project into another project.
What i can do in Eclipse is very clear:
1.Set project B as library Project (right click->properties->android->is Library)
2.Add this library into Project A (right click->Properties->android->add...->choose Project B->OK
But how can i execute such behavior in AS?
I read article
Create a standalone library with Android Studio
and Create Project A as Library in AS.
Now i create Project B in AS with module BApp,
how can i add Library Project A into B/BApp?
The reason i would not like to copy files of Project A to Project B is, I would also use Library Project A in my many other Project. I dont think it is a good idea that make a hard copy to each Project while i will always update Library A in local.
Appreciation for the Help!
You have to go to Project Structure and add the library as a new module. To do this click on the + icon and select Import Existing Project, once the module is imported go to the Dependencies tab, click on the + icon and select Module Dependency and click on your library.

how to use Android CardsUI library in Eclipse?

I am trying to use this library http://www.androidviews.net/2012/12/cardsui/. Import, libs folder and external JAR does not work.
This is an Android library project. It is not an app.
You need to attach the Android library project to your app's project. The process for this is detailed in the documentation. Basically, given that you have already imported the library into your Eclipse workspace, you right-click over your app project in the Package Explorer, choose Properties > Android, scroll down to the Libraries section, click the Add button, and choose your imported library.
You cannot just import the jar file for this project because it requires additional resources such as images. Therefore it needs to be imported as a library project

How can I use a project source code as a library for an another project?

I am a beginer in android.My client gave me a project source code(using native libraries) as a refference.Is there any possibilities to use these source code as library for my android project? If it is possible,how can I access methods of these library file? any one please help me..
Import the project into work space. Right click on the project in eclipse. Goto properties. Choose Android. Check if Is Library chexk box is ticked. If not tick the same. This is a library project now.
To refer the library project in your android project.
Right click on the project in eclipse. Goto properties. Choose Android. Click add. Browse the library project and add the same.
Clean and build.
For more information check the link
http://developer.android.com/tools/projects/projects-eclipse.html
Information regarding library project
http://developer.android.com/tools/projects/index.html
If the Android development tools build a project which uses a library project, it also builds the components of the library and adds them to the .apk file of the compiled application.
Therefore a library project can be considered to be a compile-time artifact. A Android library project can contain Java classes, Android components and resources. Only assets are not supported.
To create a library project, set the Mark this project as library flag in the Android project generation wizard.
To use such a library, select the generated project, right-click on it and select properties. On the Android tab add the library project to it.
The library project must declare all its components, e.g. activities, service, etc. via the AndroidManifest.xml file. The application which uses the library must also declare all the used components via the AndroidManifest.xml file.
Other projects can now use this library project. This can also be set via the properties of the corresponding project.
Please check this
To create a library project, set the Mark this project as library flag in the Android project generation wizard.
http://www.vogella.com/articles/AndroidLibraryProjects/article.html

How to add external libraries to my application in android

I have an application that I have to look at as a training exercise. It has used few external libraries such as SlidingMenu, ImageViewZoom and ActionbarSherlock.
I have downloaded and extracted those libraries but I have no idea how to add them to my existing project.
For those that are distributed as a simple JAR, do what Emil Adz indicates, and copy that JAR into your project's libs/ directory.
For those, like ActionBarSherlock, that are distribute as Android library projects, you will need to do a bit more work. In the case of Eclipse, you will need to import the library project into your workspace, then go into Project > Properties > Android for your application project and click the [Add] button to add the library project to the application project. For a command-line build, use android update lib-project to link the application and library project together.
You can read more about referencing an Android library project from Eclipse or the command line in the documentation.
You need to import those libraries as Android Project from existing source and mark them as "Is Library" by going into their properties.
Once you marked it as "Is Library" add it to your
project by going into Properties->Android->Library->Add (it will show the list of library you imported).
The Right Way:
What you need to do is to copy the external library (JAR file) to the /libs folder of your project.
That way those libraries will compile with your project and could be use on real device when you deploy your application.
Some times you will need to add a project to your workspace ( For example the Google Map library)
and then add the library reference using the properites -> Android window at the bottom.
You can get an idea of how it's done by reading the first 3 step of this Google Map API V2 guide I wrote. there I reference the android library project:
Google Map API V2 Guide
The Wrong Way:
any other way, like for example adding the files using the properties - > Java build path screen may result in a missing library when you run the project on a real device.
if they are jars the make a libs folder then paste the jar in it and then go to your project buildpath->configure build path->Add Jars-> ok and if it is a library project then go to your project Property->Android->Add(Your Lib Project)->Ok->Apply

Can't compile with Android Library Projects

I have two Android Library Projects in Eclipse (yes, "Is library" is selected in both of them).
One of those is ActionBarSherlock, the other one is ViewPagerIndicator
Now, ViewPagerIndicator must include ActionBarSherlock as a library dependence, so I add it under the "Android" settings of the project. Problem is, in the moment I add the library dependence, if I go to Java Build Path of the same project I can see that the dependence .jar of the added library is required but not present (of course, as it is a library project, no jars are created!).
What can be the problem? Furthermore, I have to add both libraries as dependences to an Android application, which presents the same issue.
Are you using ADT14? If so, you probably need to migrate the library projects to the new structure. Right click the library project and select 'Fix project properties' from the Android tools menu.

Categories

Resources