Using libraries in an android project - android

I have found a library that I'd like to use for my android app. On the github page of the project, there is a tutorial on how to add the library to your own app so that you can use it, but I have problems following it: https://github.com/gabrielemariotti/cardslib/blob/master/doc/BUILD.md#reference-this-project-as-a-library-in-eclipse I know how to add .jars or projects as libraries to my own project using eclipse, but I don't get the library into my workspace in the first place.

In Eclipse, File -> import -> Android (NOT General) -> Existing Android Code into Workspace -> Select the library folder -> you should see the library
If the import option is not given, make sure you don't have any project by name "main" in your workspace. If you do, rename that project to something else and repeat.

Related

Adding a library to eclipse

I am new to Eclipse and I could not solve this problem.
How could I import this library to Eclipse using the default builder (not using Gradle)?
Without using Gradle/Maven and using Eclipse you need to manually add the library.
The library is in the jcenter repository, which means there is a jar file available. This jar file can be found here (I'm pretty sure you need the -sources.jar)
Download this library and save it in a logical place. Go to Eclipse, highlight the project and press Alt+Enter. Go to the Java Build Path page and click Add External JARs under the Libraries tab. Select the JAR file and it should be fine.
Keep in mind that the Eclipse ADT plugin is not the way Google wants you to do it. If you have no reason to use Eclipse other than that it's what you have set up now, you should probably move to Android Studio.
Create a new project and add github version project files to newly created project else download the entire project from github and add this project to your current project.
right click(current project) -> Build path -> Configure build path -> Java build path -> Projects (tab) -> click add
Just add this project there and build your project.

Importing android-crop library in my project

In my app I want to implement android-crop library: https://github.com/jdamcd/android-crop
I'm using eclipse. I have installed gradle plugin , but I'm new in gradle and I don't now how to import this library in my project and use it. When I import this library I get project like on image, but I can't launch this example application.
Can some one tell me how to import library in my project and how to use it.
Thanks
If you are using Eclipse you should:
clone the repo locally
import the code in your workspace starting from lib folder. The Wizard will import the code in lib/src/main. I suggest you naming it "croplib" (or another name) instead of "main".
mark java(*) folder as source (click on folder -> Build-Path -> use as source folder).
mark croplib as Android Library (Properties -> Android -> Is library)
Clean and build
I suggest you switching to Android Studio.
In this case, just open your project and add this dependency to your build.gradle file.
compile 'com.soundcloud.android:android-crop:0.9.10#aar'

How to import an existing Android Library project into Eclipse workspace

I see there are powerful support projects out there like this one: https://github.com/JakeWharton/Android-ViewPagerIndicator
All the tutorials and posts I have found describe:
what an Android Library Project is
how to create one from scratch
how to reference one after it's already in your Eclipse workspace
But I haven't found the correct steps for how to do an import into eclipse for such a project.
I have tried to create an empty Android library project and then copy over the files; and then also tried to link to the library project root folder in the eclipse project config for another empty project. Those didn't work.
So my question is .. what's the correct way to import the ViewPagerIndicator project into my Eclipse workspace?
Thanks
Right click on Workspace - > Import -> Existing Android Code Into Workspace -> Library Folder
Note:
To avoid other inconveniences, do this:
1) Once is already in your Workspace, make sure that the project is marked as "Library." Right click on Library -> properties -> Android -> Check Is Library
2) At the time of importing, change the name of the folder. Please, specify something different than just "library". Projects on github usually come that way.
3) Make sure that every file is in the folder. For instance, Eclipse won't import anything if project.properties is not inside the Library folder. In a similar situation, Eclipse could import the project, but it would not create the R.java file if something is missing or there are errors in the layouts of the library.
4) Make sure that all dependencies match with your project. For instance, if certain library needs android-support-v4.jar, make sure that both (project and library) share the same version of the file. Once again properties -> Java Build Path -> Libraries -> Add or remove Jars
5) To make your project dependent of the imported library, Right Click on the project -> properties -> Android -> scroll until the end and add the imported library.

Including library to android project

I have downloaded a library from github, and imported it as android project.
In this library that called Library under preferences -> Android I have set it as a library project as seen bellow:
Now I want to add this library to my Android project that called test. So I Right-Click on it and than preferences -> Android, after that I click add... and choose the library, as seen below:
Than I hit ok and apply and ok again. Nothing happens. After that I click again Right-Click on my project and than preferences -> Android and here is what I see:
What should I do to make it work fine?
The github project link is here.
I downloaded the project from the git and checked it,The .project file for eclipse is missing.
My solution would be create a new project and use these resources

How to include GitHub library to your existing Android project in eclipse

I want to include this library from github to my existing project, I am using eclipse.
Is there any tutorial on how to do this? I am new to android and java development so any step by step help would be great!
note:
I have an Egit plugin installed in eclipse.
Image of the screen when I try to Import the library from the unziped file I have downloaded from the github page:
Also after importing the library as suggested below a library folder created in my Package Explorer but here is what I get:
I have now the library in the eclipse Package explorer, and now I want to add it to my project, so I Right-Click on the existing project and choose properties. Under Android liabrary i click ok and choose the library than ok, nothing happens!
Right click on your project -> properties -> Android -> Add. There you can hose a library.
I got the same problem as yours, please check my answer here , hope it helps.
Extract the zip,
Right click in your workspace -> Import -> Android -> Existing Android Code Into
Workspace -> give path of that project/library
Done.

Categories

Resources