Adding library project to PagerSlidingTabStrip - android

I'm trying to use
Android PagerSlidingTabStrip v1.0.1library
in my project but, after I import the project as existing code in work space I get to project
the Mainactivity and library and and the library is a dependency to the Mainactivity
but it seems that library project doesn't recognized as local library
so what i did is
1- I tried to make a jar file called library.jar from the library project
and I imported as a external jar so that fixed my import but when I try to use PagerSlidingTabStrip object it says missing reference
and beside that there is res folder couldn't be loaded .
2- I follow this How to add a Library Project to a android project
and I did like what the accepted answer said but it still didn't work for me .
This is how I added the library project
That what I got in project libraries
I tried to use this dependency in build.gradle
dependencies {
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
}
but it didn't work
i added before sherlock to eclipse so when i added it inside the root folder
a bin folder created and inside it there are a jar file and that's
doesn't happen with library so i think here is the problem
any help?

From properties window select option android scroll down, below library heading click the add button and select library project.

I was facing the same issue but soon i came to know that there was support library missing from Library project.
Add support library and clean build the library project and then add it in your project

Do the following:
File->New->Other
Select Android Project
Select "Create Project from existing source"
Click "Browse..." button and navigate to "PagerSlidingTabStrip-master" folder which you have downloaded from https://github.com/astuetz/PagerSlidingTabStrip
Check "library"! (Uncheck "sample"). Make sure "Copy to Workspace" is checked as well.
Click Finish. Now "library" is project in your workspace.
Right-click on your project -> Properties
In Android -> Library section, click "Add"
Select recently added "library" project, click Ok and you're all set.

Related

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.

Android install external library

I want to use this library https://github.com/koush/ion in my project.But I don't understand how can I install it.I am using Windows 8 and Eclipse.How can I install ?
Download that project and put it in workspace of eclipse and import it from work space to eclipse and make it as library project and add it to your project.
Steps to import:
Right Click on package explorer
Import
Existing Project into Workspace
And then browse to the location where the project downloaded
Import it
Steps to add it as library to your project:
Right-click on your project -> Properties
In Android->Library section click Add
Select recently added project -> OK
That's it!
Now you can use it
You must perform the following steps:
Download ion project code.
Import it in your workspace using eclipse.
Right click in your current project and select Properties. The project properties windows must be opened.
Select Android option.
Go to the bottom of this tab and you can view the Library section.
Add the library dependency using the Add button.
I hope that helps!
You are probably better off downloading the jars vs the source.
https://github.com/koush/ion#get-ion
Download those two and place them in the "libs" directory of your project. If that directory does not exist, create it. From with your Eclipse project preferences, you can add those jars as dependencies.

Appcompat does not work

I am trying to use appcompat in my application. I have done everything according to the instructions. But when I add android-support-v7-appcompat as a library in my proect, I have an error like so:
Description Resource Path Location Type
The container 'Android Dependencies' references non existing library
'C:\Android\workspace\android-support-v7-appcompat\bin\
android-support-v7-appcompat.jar'
testActionBar Build path Build Path Problem
what am I not doing right?
delete appcompat.jar and v4-support.jar from libs folder
clean ur project
How to add android-support-v7-appcompat as a library
import android-support-v7-appcompat in eclipse as a library project and
check copy into workspace
add android-support-v7-appcompat as library in ur project
right click on ur project -----> properties ------>android
------> add
clean ur project
I think this will help u
Before creating the project, run eclipse as Administrator so that it creates the jar in the location that it is referencing to.
Right click the eclipse icon and select the option"Run as Administrator"
Just do the following steps
appcompat_v7_nn right click build project;
click to your project, project clean
Delete jar library from every directory you add. Then you need to add appcompat as a dependency. If you use Android Studio, you need to do as following:
add this
compile 'com.android.support:appcompat-v7:18.0.+'
into your gradle dependencies and after that, Build -> Rebuild Project.
With "compatibility" files problems you can try to delete / or rename for security any appcompat "project" in eclipse and create a new project using a compatibility mode (different target and "required" SDK values, equals to your version needs), it will generate a new appcompat project, remember to link your existing project to this appcompat project and check your lib for no duplicate compat. jar.

Cannot Add Library to Android Project in Eclipse

I am trying to add a Library to an existing project inside eclipse. I am keeping the Project Folder itself and the Library Folder in a folder marked "ANDROID" on my desktop. When I try to Import > Existing Code into Workspace > Select "ANDROID".. the only project that gets added is the App itself and NOT the library. I even try to add the library on its own and it will show up on the import list but will not have a "ticked box" with the option of "Finish".
I even right clicked my App - Properties > Android > and noticed that the library is there with a red "X" and does not allow me to search for a new library. What am I doing wrong?
This Identical App and library is working with the same version of eclipse for a friend and not me.
Make sure that the libraries and the project are at the same place, i.e.
Copy the libraries in the same folder as your project
Import the libraries (file > Import > Existing Project in workspace)
Open properties of library > Android and select Is Library
Open project properties > Android > Add (library)
Select the library
save the properties
If this does not work for you copy the jar files from its lib folder and paste it in the projects lib. This should only be done if the above method doesn't work
Import Library project in eclipse . Then right click on project and go to properties->Android (Menu on left side) --> At the bottom(below project build target) you will see a check box named is Library Check that box. Now you've made your project a library .
Then in your orignal project where you want to add library go again to to properties->Android (Menu on left side) --> At the bottom(below project build target) Click add button and you will find that library project visible.
This happens when you import the project from some location. If we import some project then it doesn't refer to the supporting library of that workspace. So always check the check box( copy projects to workspace)
Go to file>import project>browse>select a project>Check the copy project into workspace.
Hope it solve the issue.
A late answer, although I thought of giving an in-depth answer to this question.
First switch your folder structure from Android to Project.
Now search for the libs folder inside app - build folder.
Once you have pasted the .jar file inside libs folder. Right click on the jar file and at end click on Add as library. This will take care of adding compile files('libs/library_name.jar') in build.gradle
Now you can start using the library in your project.

Add *.jar file in folder named Android Dependencies

I want to use library from openCV named "opencv library -2.4.3" , I install all what it needs , and now openCV tutorials work. So I need add the same openCV library to my project for use.
QUESTION
How to add opencv "library -2.4.3" from another project to mine's folder named Android Dependencies
Thanks in advance
Create a libs folder (/libs) in your project's root folder.
Copy the wanted jar to it.
It will be added to Android dependencies.
You have to click on on the project properties (Right Click -> Properties) and add it as dependency there.
I just did this with a project, using eclipse 4.2.1. As with the other answerer, all I had to do was create a folder called "libs/" in my project, and it auto-updated the Android Dependencies list. Are you copying and pasting inside of eclipse?
I moved the file to that folder using the file system, outside of eclipse.
This link describes how the libs folder gets added to Android Dependencies:
http://tools.android.com/recent/dealingwithdependenciesinandroidprojects
Right click on project
Select Properties
Click on Android on left menu
Click on Add
Please select a Library Project
The jar will go into Android Dependencies.
If you add the jar directly to your project under libs or using build path, then it goes under Android Private Libraries.
Both methods works but referencing a library project can have benefits if you want to alter the code of the library during development.

Categories

Resources