How to include a custom library from GitHub into my Android app? - android

I am trying to use this library off of GitHub for a Segmented Control in Android.
My problem is that I do not know how to include the provided library into my existing project. I've tried copying the src and res files (of the library and sample) into my project and modifying their package names to match mine, but the files are filled with errors and will not compile.
I am new to Android development, and so I am unsure how to bring these files in to my project so that I can use them and create the desired segmented controllers.
Note: I am using the Eclipse IDE from the Android website (ADT v22.6.2).

Hi there you will want to actually clone the whole repo and import that project as its own project and then reference that project via this method. Eclipse Android project, how to reference library within workspace?
Good luck.

Related

Adding reference to shared project in an Xamarin iOS project

I'm currently trying out Xamarin (on a MacBook, all needed SDKs are installed) and have created a shared project solution.
Within this solution folder there is the autogenerated shared project (called "Project") folder and two projects which I created: An Android project ("AndroidApp") and an iPhone unified single-view Project (iOSApplication).
Now I have added the references to the shared project in both of the other projects so i can use the code from the shared project in the other ones.
So I add "using Project;" add the top of the android project's MainActivity file and it works. I can use classes of the shared project in my Android project.
Doing the same in the iPhone project does not work, and I don't know why.
I'm almost certain that it is my fault because I misunderstood something but I can not imagine what.
Here is a picture of my current workspace in case my discription is unclear.
http://pl.vc/4ndf3
Thank you in advance.

Creating standalone android library project using Android Studio (0.8.14)

I see there is option to create module/ android library project with in a project, but don't see any way to create a standalone library project/module that could be shared across different projects. It used to be very simple in Eclipse. When I try re-using an existing module within a different project, AndroidStudio simply creates a copy of that module in new project. Thats what I don't want, I want to re-use my existing code. This link seems to have answer I'm looking for, but not working for latest build for Android Studio.
There are a couple of ways I've tried doing this, a quick and easy way to do this is to symlink your library module directory to a directory in your project and add it to your settings.gradle. A better way to do it is to import the library module as a VCS project (local git works fine) It will still clone the library module into each project but changes made to the library will be consistent across all of the projects using it.

I can't access Crouton library in Eclipse

I followed all the steps for using the crouton library with Eclipse, but I still have not been able to use it.
Here are the steps I followed:
Clone the Crouton library from GitHub.
Unzipped the file and copied out the library folder.
Open eclipse and import the library into the workspace (The name changes to 'main').
Right-click on 'main' and select Add Support Library in the android tools option.
Open project properties set build target to 4.4.2, and tick 'is library'.
In the project which I want to use crouton, I add it as a library from the property option.
After all these steps when I try to create a crouton. For example:
Crouton.showText(
this,
getString(R.string.crouton_message2),
Style.CONFIRM);
Eclipse says Crouton cannot be resolved to a variable. When I to try import it, I can't find it.
These are the same steps followed in all my research, here's what I found, a post from Grokking android and a YouTube video
This is not the first time I am using a library. I have been using the android appcompat library for a while now with out any problems. And the steps i used in setting it up are pretty much the same with is, except that in the appcompat library after all the above steps, I had to copy the jar file and put it in the lib. folder of the project that needs it.
I'm I missing anything?
Thank you for your help.
Crouton is being built using gradle.
This means that the source directories are different to the default Eclipse source paths.
I discourage building without a proper build system.
Nonetheless, using version 1.8.2 of Crouton within Eclipse is possible.
To do so, simply download the jar from maven central and put it in your libs folder.
Since the current version of Crouton does not rely on resources, adding it as a library is not necessary.

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

Android and Eclipse - referencing Library

What is the correct way to reference a library?
I start a new Android application using Eclipse.
I add a new Library application.
I add the project in the Java Build Path for the main application.
This compiles fine, but at runtime I get an error because the "library" file is missing from the main application, so my question is, what is the "correct" way to get the library into the main application?
I am used to Visual Studio, and referencing another project automatically ensures that the reference copies the required DLLs to the project BIN folder.
I understand that the library file's JAR/APK must be in the LIB folder, but does Eclipse do this for you when you reference it? It appears not - so do I import?
First you need to build your library project, and only after that add it into main project as library. Please follow this post.

Categories

Resources