Adding a library to eclipse - android

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.

Related

Compile errors in new Android project in Eclipse

I'm using Eclipse for build an Android project. when I try to open bellow item :
file --> new --> Android Application Project
Then when the project is built a series errors displayed :
I am a beginner in this regard and thank you for your help.
Open AppCompactv7 and add as library on your project
The problem is with your appcompat_v7 project. Delete the existing project one in the workspace and re-import it from
\sdk\extras\android\support\v7\appcompat
After that try cleaning the project.
Project -> select Clean -> select the project.
1 - Make sure library project(appcompat_v7) is open & is proper referenced (added as library) in your application project.To do this follow this steps: right click in your project -> "Properties - Android - Add"
2 - Delete android-support-v4.jar from your project's libs folder(if jar is present).
3 - Appcompat_v7 must have android-support-v4.jar & android-support-v7-appcompat.jar inside it's libs folder. (If jars are not present copy them from /sdk/extras/android/support/v7/appcompat/libs folder of your installed android sdk location)
4- Check whether ActionBarActivity is properly imported. (In your case this is right)
import android.support.v7.app.ActionBarActivity;
Here is a good example of how to create a project in Eclipse using v7 Support Library
Finally because you are a beginner I'll recommend you to use Android Studio as it is the official environment for developing for Android. Configuring the SDK can be quite a pain in Eclipse. You can also take advantage of the Gradle dependency system and simply specify which libraries you would like to use and Android Studio will automatically fetch the jars from online remotes as required. I think its the future of Android Application Development.

Building a project on Eclipse didn't output any bin/*.jar file

downloaded the following open source.
https://github.com/umano/AndroidSlidingUpPanel
Import /library to Eclipse as a Existing Android Code.
There's no error after building the project.
I would like to add the library to my developing app. So I guess I have to build it successfully with library.jar being output to /bin. Or is there other way to make dependency between them ?
You should set the AndroidSlidingUpPanel project as library project. After doing that, in eclipse, right click on your project in which you want to add the AndroidSlidingUpPanel project and go to properties. Then go to android section. In the bottom, click on add Library and select the project. You don't need to add jar manually, eclipse will do that for you.

Android support v7 app cannot be resolved error

I am running eclipse juno on a 64 bit windows 8.1 machine, I have imported a project into eclipse, but the error i am facing is
On reading about it, I came across the solution that I am supposed to configure the build path manually,
but I am unable to do so since,
Please help
In your screen shot I can see app-compact project imported; This should cause your problem. In better word: when you are using app.support.v7 libraries you must import app-compact project in your workspace and add it as your project dependency.
follow below link of developers:
https://developer.android.com/tools/support-library/setup.html
Especially this part will help you:
1- Make sure you have downloaded the Android Support Library using the SDK Manager.
2- Create a library project and ensure the required JAR files are included in the project's build path:
2- Select File > Import.
3- Select Existing Android Code Into Workspace and click Next.
4- Browse to the SDK installation directory and then to the Support Library folder. For example, if you are adding the appcompat project, browse to /extras/android/support/v7/appcompat/.
5- Click Finish to import the project. For the v7 appcompat project, you should now see a new project titled android-support-v7-appcompat.
6- In the new library project, expand the libs/ folder, right-click each .jar file and select Build Path > Add to Build Path. For example, when creating the the v7 appcompat project, add both the android-support-v4.jar and android-support-v7-appcompat.jar files to the build path.
7- Right-click the library project folder and select Build Path > Configure Build Path.
In the Order and Export tab, check the .jar files you just added to the build path, so they are available to projects that depend on this library project. For example, the appcompat project requires you to export both the android-support-v4.jar and android-support-v7-appcompat.jar files.
Uncheck Android Dependencies.
Click OK to complete the changes.
You now have a library project for your selected Support Library that you can use with one or more application projects.
Add the library to your application project:
1- In the Project Explorer, right-click your project and select Properties.
2- In the category panel on the left side of the dialog, select Android.
3- In the Library pane, click the Add button.
4- Select the library project and click OK. For example, the appcompat project should be listed as android-support-v7-appcompat.
5- In the properties window, click OK.
Update
Also you can import and copy the 'appCompact' library directly to your workspace and then add it as you project dependency. Please follow steps in this guide in order to adding the 'appCompact' by this way:
https://yassirh.com/2014/01/getting-the-android-navigation-drawer-to-work-on-old-versions-of-android/
(The above link is in order to using navigation drawer in older version but same objects are using appCompact and using it have same solution for both)
First of all
Make sure that you've installed already the following libraries Android Support Library, Android Support Repository and Google Repository by checking in the Extra folder by openning the Android SDK Manager in eclipse.
if it is already installed then add them to Eclipse
Eclipse -> Import -> Existing Android Code into workspace.
Add /android/adt-bundle/sdk/extras/android/support/v7/appcompat to your Eclipse workspace.
Right click on the project in Eclipse and select properties.
Select Android -> Library -> Add.
Select appcompatv7 project and Save.
Use import android.support.v7.app.ActionBar to import Action bar in activities and fragments.

Project library not getting added to android project

Iam trying to reference a Android project library to my application. I do this:-
1)File->Import->General->Existing project into workspace->Select project library->check copy to workspace.
2)Right click on project->Properties->Android-> Add-> Select project library-> Apply-> ok.
But when I again check if the library is added I get the following:-
How do I resolve this?
Make sure that your library has the same location with your project source files.
It means that if your source is on your workspace , then your library should add into workspace. If not, you should copy your lib into same folder with source then mount it again.
Make sure the library project is checked as a library.
Go to the library projects BuildConfig -> Android -> Check "is library"
Make sure your project and the library project have the same target/min SDK versions.
It's also a good idea to clean your workspace and Build the library project - Right click on library project -> "Build Project"
Try this answer:
The project name needs match the folder name on the file system. What you are seeing in the Project Properties->Android->Library Reference is a relative file system path.
Reference:
In eclipse, unable to reference an android library project in another android project
Thanks to archie-bpgc for comment
i am also facing this problem i have solve this problem like
when import lib in to workspace tick mark as show in picture (basically library project and your project both are in same workspace)
now add lib to your project and clean project
you need to import the project to workspace and the library file into the same workspace.
Then you will not face this error. Kindly the root cause is not known. But this method works.
After all this .. one more way is you can alter the project properties last line where the library file path is specified.
Thank you.

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

Categories

Resources