I am beginner in android. My client gives me a sample project as reference. In that project have an extra folder 'android dependency’ and that contain a jar file 'annotation.jar' .How can I add the very same jar to my project dependency folder? Any one please helps me!
Find "libs" directory in your project. Those will contain physically those jar files. Android Dependency will indicate that how many libraries are associated with current project.
When you find "libs" directory, right click on jar files, and you will find "Build Path" and then add them to build path. will solve your problem.
Edit
Go to the SDK Manager within eclipse (Window --> Android SDK Manager) and installed the Android Support Package which is found in the Extras folder.
Follow this: Project->RightClick->Properties->BuildPath and Add External jar then browse for particular jar file and Add.
Just copy it in your libs folder and refresh your project. Remember it should be libs not lib. Also remove it from your "external jars" path from Project->RightClick->Properties->BuildPath
Edit :
And also try this
Also remove android.jar file to your build path.
Related
I imported an Android project into Eclipse (Custom ADT). During the import process, I chose to copy project into Workspace.
My project could compile and run well but after sometime, it stopped working. When I check in the 'Problems' View, I see that it still looks for the BIN folder in the folder from which the project was imported and it can't find the library it wants to reference.
Aren't Libraries copied along with the project in Android? How do I fix this?
A good way to add external JARs to your Android project or any Java project is:
Create a folder called libs in your project's root folder - you already had this
Copy your JAR files to the libs folder
Now right click on the Jar file and then select Build Path > Add to Build
Path, which will create a folder called 'Referenced Libraries' within your
project
By doing this, you will not
lose your libraries that are being referenced on your
hard drive whenever you transfer your project to another computer.
You need to place the Libraries into your libs folder before you copy/import. Because if you just added the Library over the Build-path its just copy the Reference, not the Library itself.
I want to use a svg-android library to work with *.svg files in Android. For the same, I've installed the apache ant, created a folder in workspace called: SVGAndroid and then added
android.library.reference.1=C:\Android\workspace\SVGAndroid
to project.properties file.
There were no documentation for functions in ReadMe, so I'm wondering if the installation correct or not, how to reinstall an external lib in the second case and where are the examples of using svg-android?
For your including of the project, just include the project into your workspace and in your respective application under the properties of that project just add a dependency on a library that references svgandroid. Make SURE to include the files and ensure that the compile class files are present in the final output of the apk. This typically means that you add the project to your build path/order.
Another approach is to just take the entire project and compile it into a jar file and then include that jar in your libs folder and add that dependency on the jar file of that respective project to your core application.
Useful links
How can I use external JARs in an Android project?
I would rather suggest to not add the path to the project manually, but from Project Properties -> Android and you will have a list with all the library projects in the workspace from which you can choose the desired project.
Also I suggest adding in project.properties the following line:
manifestmerger.enabled=true
in order to have all the AndroidManifest.xml files of the referenced library projects merged into the main project's manifest.
If you want to include a library file in to your project follow the below steps;
Download a jar file and save it in any folder.
open your project.
Right click--> Build path--> Add External Archives---> Add your external jar file to your project
I am trying to compile a java project which makes uses of android libraries. The project I am using is checked out from a svn repository.
In order to take a use of that project I am required to define some jar files and libraries for that project.
Here are the files that I need to make sure they are defined:
•"lib/apache-mime4j-0.4.jar" : Jar
•"lib/httpmime-4.0-beta1.jar" : Jar
•"lib/slf4j-android-1.5.8.jar" : Jar
•"JUnit 4.libraryclasspath" : Library
•"ANDROID_SDK_PLATFORM/android.jar" : var
•"Java JRE System Library" : Library
Does anyone have any idea about what should I do to define these files? I am a noob here.I do not know which selection should I choose When I clicked "project -> properties -> java build path -> libraries"
For example if I want to define the first jar file, there are a "add external jar" and a "add libraries" selections.
However you can see a "lib" here in front of the "apache-mime4j0.4.jar file" in this list above..
So I don't understand if it is asking me to add a jar file or the librabry.. I am getting very confused about this.
And also How can I do anything with "JUnit 4.libraryclasspath" file? I think it is a classpath file so I cannot either choose "add jar files" or "add libraries" to define it..
Hope someone has any knowledge about this and I will be very appreciated!
I think You are unable to include the files due to SVN path but will discuss it later.At first we look how to add jar files
Right click on your project in which you want to add the jars
1.select build path and then "configure build path"
2.click on "Libraries" tab
3.Now click on Add external jars (as your all jars files would be placed in some directory outside the project folder or anywhere else)
4.Select these jars and now do OK ... Now these jars are in your class path and you can use these files.
Now another thing, As You told that you are using svn , It means many of other developers are also using the same project then it is compulsory that all of you have same path of jars in your systems for instance in Dev1 PC the jar if the jar file is placed in d:/lib/jars folder then all other DEV2 , DEV3 ... DEVn must have d:/lib/jars folder and their jars must be placed there and you have to add these jars from d:/libs/jars
Last thing , If you are still unable to understand the solution and remove the bugs then simply do this.
Copy all jar files manually (ctrl+c) and copy to lib folder in your project as i have seen that in your project the person who commits the code place them there.
after then , right click on your project and click refresh(as it is bad practice to put jar files in project by creating folder like lib etc unless it is a web project)
Let me know if anything is unclear about this
I am working on an app which uses Commonslang.jar libraries. I was trying to setup it on a new system with newly installed Eclipse.The project is not showing any error But when I run the project it force closes with NoClassDefFoundError at each point where I use Commonslang lib.
I dont know how to fix this problem.Please help?
I think there are "lib" folder in your project directory so just change it "libs" instead of "lib" and clean project and check it..
> Note: No need to build path for any third party library
You need to create libs folder in your project and copy that jar file there. Then in eclipse, right-click on that jar file (which is in libs folder) select Build Path and then select Add to Build Path.
Remember: if you are using a jar file in your Android Library Project, and associating that library project with your regular UI
project, it won't be enough. You must need to include that jar file
(as described above) in both of your projects (Android Library and UI
project) to make it work.
Have you added the jar to the Java Build Path?
Go to the Properties for the Project and select Java Build Path -> Libraries tab then add the external jar there.
I made a folder called libs to my working space.
I copied the android-support-v4.jar in it.
Pressed right on it Build Path > Add to Build Path.
Next i added a library and there it needs the Viewpager.
Afterwards i cleaned my project, but i cann't access android.support.v4.view.ViewPager.
Eclipse don't find android.support as well
Solutions?
You should add the library to your build path after you copy the file in the libs directory.
Once you copy the file in libs directory, right click on project, build path, libraries and select the libs directory of the project and add it.
You can then import the classes.