Adding a JAR file to an Android application - android

I want to add the jTwitter library to my application.
How can I add and build the path for it?

Hai Nikki,
If you are using Eclipise IDE, then follow these steps shown below.
step1:
Right click the project Name, there yiu find a option Build path(Refer Figure1)
step2: click Build path then configure Build path(Refer figure2), a dialog box will appear, in that click Add External Jars , select and add it(refer figure3).
figure 1:
figure2:
figure 3:

In case you are using Eclipse go to Project → Properties there navigate to Java Build Path on the tab Libraries hit the Add External JARs button and select your JAR file.

Related

How does one add an external library jar to 'External Libraries' section of an Android Studio 1.3 project?

Trying to migrate to Android Studio 1.3 from good ol' Eclipse but it's frustrating.
How does one add an external library jar to 'External Libraries' section of the project?
Reading SO posts including here, I went to File|Project Structure|Modules
selected app and Dependencies tab.
Clicked '+'
It brings up the Select Path below
How do I add a jar file from D:\mylibs when the Home icon is disabled in the screenshot below?
I tried to copy the jars, and then right-click 'External Libraries'
and Paste but it did not work.
There is something wrong with the AS 1.3 dialogue where you add the .jar file. There are no buttons to navigate up the directory tree or change drives. Instead, to add the library, select the .jar file in Explorer (Windows), right click on it, select Copy, go to Android Studio, select Project->[NameOfYourApp]->app->libs and right click on libs and Paste file into it, click Ok on the confirmation box. Then, right click on the .jar file, go toward the bottom of the menu and select Add As Library. Then in the Create Library box confirm that it is adding to app and click Ok. Gradle will then automatically add it to the build dependencies. You can then check the build.gradle file to make sure you see this line: compile files('libs/[filename].jar') under the dependencies section.
Click on your project name on the project explorer, press "F4" or right-click on the name and select "Open Module Settings". Then click on "Dependencies" tab, and click the green "+" button on the right side, then select "File Dependency", this will bring up a Browse Window, use it to open the ".jar" or the ".aar" file.
Follow the next process and you should get it:

How to use OSMDROID?

I'm using OSMDROID libraries for the offline map. I added these libraries to the Project:
"osmdroid-android-3.0.10.jar",
"osmdroid-android-3.0.10-javadoc.jar" and
"slf4j-android-1.5.8.jar"
I have downloaded the requirements map and now, what should I do to this map? I'm trying to run the application but errors happen.
Simply adding the libraries files to your project won't work. You have to build the path also and then configure the build path and add source and javadoc location to your added files.
Configure your build path for osmdroid-android-3.0.10.jar. Please follow the steps given here:
Right click on your added library files select Build Path --> Configure Build Path.
Select library tab
Explore osmdroid-android-3.0.10.jar and select source attachment
Click Edit Button on the right side and select Workspace Location in the pop-up screen and locate your file where you saved or copied the osmdroid-android-3.0.10.jar file.
Similarly Select Javadoc Location and click on Edit button. In the pop-up screen select Javadoc in Archive and then select Workspace file. Now browse the Archive path where your javadoc file is located. Finally browse the Path within archive, select the file there and click ok. You are done with adding the library files properly.
Possibly you might have not added you library to your project correctly. I recommend you to follow this article:
http://www.haakseth.com/?p=30

How to Start the Vuforia AR sample App android?

I am following the Vuforia and I have run the samples, It's working fine but if I want to start the our own app so could you help me how to start the app.
Thanks.
Please follow the below steps to integrate vuforia with your android project.
1)copy vuforia.jar and armeabi-v7 folder that contains libvuforia.so and paste it on your libs folder of your project.
2)right click on your android project and go to build path>cofigure build path and select libraries tab and add vuforia.jar file.
this will work now you can easy to use vuforia functions.
if you want to create your own marker then you have to log in in https://developer.vuforia.com/targetmanager and create project and then download .xml file and .dat file and then integrate that file with your android project
For Android Studio 2.3.3
1. Copy vuforia.jar and libvuforia.so in your libs folder
2. In your app, right click and select open module settings
3. Click On the dependencies and '+' sign to add "jar dependency"
4. Select vuforia.jar and click Ok
Done!

how to include jar files in my eclipse project

I'm new to android and java. I downloaded the GSON library for use in my android project which exists in Eclipse. I lookup instructions on how to use the jar file in my project and it says...
Quote...
You can use a third party JAR in your application by adding it to your Eclipse project as follows:
In the Package Explorer panel, right-click on your project and select Properties.
Select Java Build Path, then the tab Libraries.
Press the Add External JARs... button and select the JAR file.
Alternatively, if you want to include third party JARs with your package, create a new directory for them within your project and select Add Library... instead.
It is not necessary to put external JARs in the assets folder
...UnQuote
I'm afraid that I don't know the difference between "using a 3rd party jar in my project" and "include third party jars with my package." I want to be able to use the GSON methods in my Android phone application and, of course, have the capability deployed in my .apk.
So, Which do I want to do?
Thanks, Gary
add the jar to your libs folder in your project.
open eclipse go to package explorer
right click on your project and select project properties
click on java Build path in the bar on the left hand side of the popup
select the libraries tab
select the "Add External Jar File" and navigate to your JAR file
best of luck =)
click Properties
left select Build path
Than add jar, and do not use the external libs, unless it is really required.
You have to copy the jar to your project to find it with "Add jars"
Right click onto your main project in the Project Explorer
Open properties option, found at the bottom of the context menu
A dialog box opens from which you select the Android option
Remove the old .jar file, click on ADD to add a new .jar file and select your the file you want to add
You're done!

Create Jar file for android project

I want to create a jar file from one android project for another android project.I want select only certain classes not all classes from project.I tried eclipse-export way to create a jar.Jar file is created and it also contains all selected class files,after adding the created jar file to the main android project it gives the error:“java.lang.NoClassDefFoundError”.Is the eclipse-export way is not valid to create jar for android project?
I also tried steps provided by this blog http://www.olivacorner.com/2011/04/create-an-android-jar-library-with-eclipse/comment-page-1/#comment-343,but not able to create a desired jar file.
Can anybody please provide the steps to create a jar file for android project.
Thanks.
So you want to create a library for Android? In this case, you can create a Library-project and then reference to it in the main-project.
See the docs.
Step 1. Create Android library project as explained here.(Same as suggested by Lukas)
Step 2. Now you need to give reference of Android Library project created in step 1 to your client application. There are two ways to do so.
Give reference of Android Library Project itself by client app property -> Select 'Android' on left pane -> In Libraty Section, Add Android Libraty project (This is explained at link given in Step 1 above)
Give the reference of .jar file of Android Library project (from Location of Android Library project -> bin -> .jar file). Client Application -> Properties -> Click 'Java Build Path' in lefe pane -> Go to 'Libraries' Tab -> Click 'Add External JARs' button and select the .jar file -> Go to 'Order and Export' tab and select the added .jar file reference and move it to top.
Hope this will help you.

Categories

Resources