-1

I want to use this library in my android app:

https://github.com/Gottox/socket.io-java-client

But I don't know how can I import library to my app.Can you explain this ?

(I am using eclipse)

Tolgay Toklar
  • 4,151
  • 8
  • 43
  • 73

1 Answers1

1

You can right click your project -> properties -> Android -> Add. There you can add the library.

enter image description here

NOTE: There should not be another project with the same name(library presumably) in your workspace.

Also check - How to include GitHub library to your existing Android project in eclipse.

UPDATE:

I copied these files to libs folder.But still not showing in the list.

Steps to import the library project in detail -

  • Download the project from https://github.com/Gottox/socket.io-java-client.
  • Unzip the project into the same workspace where your current application workspace is.
  • Import the project in eclipse.
  • Right click the project and go to project -> properties -> Android .
  • Tick the checkbox for Is Library.
  • Go to your application in eclipse.
  • Right click your application -> properties -> Android -> Add
  • Now you will see the project in the list where you can add it.
Community
  • 1
  • 1
sjain
  • 23,126
  • 28
  • 107
  • 185
  • I can't see in the list.I imported to workspace but I can't see in the library list.Here you can see:http://prntscr.com/475173 – Tolgay Toklar Jul 28 '14 at 13:08
  • No, you first need to put your `socket.io client library` into your project workspace libs folder where your other jar files exists. Then you follow the above instructions to import. – sjain Jul 28 '14 at 13:12
  • Which files I have to copy ? I copied socket.io folder to project root folder but not worked. – Tolgay Toklar Jul 28 '14 at 13:15
  • You have to copy `WebSocket.jar` and `json-org.jar` from this url - https://github.com/Gottox/socket.io-java-client/tree/master/libs – sjain Jul 28 '14 at 13:16
  • I copied these files to libs folder.But still not showing in the list. – Tolgay Toklar Jul 28 '14 at 13:19
  • Didn't understood what do you mean by not showing ? The copied files are already there in your project. You just need to import them now by `project -> properties -> Android -> Add`. – sjain Jul 28 '14 at 13:21
  • Here you can see:http://prntscr.com/4754vj What is wrong ? – Tolgay Toklar Jul 28 '14 at 13:22
  • OK, check my detailed updated answer. – sjain Jul 28 '14 at 13:34
  • But there is no android tab : http://prntscr.com/4759p3 – Tolgay Toklar Jul 28 '14 at 13:39
  • You need to import this project as a `Import -> Existing Android Code into Workspace` just like you normally do for any android project that you create from scratch. Meaning import like android project to see Android Tab. – sjain Jul 28 '14 at 13:45
  • I tried but I can't import as an android project.http://prntscr.com/475d1b – Tolgay Toklar Jul 28 '14 at 13:50
  • ok then first do `Import -> Existing Projects into Workspace` and then import to your application's workspace. Remember to tick mark `Copy Projects into Workspace` in the `Import Projects` wizard. – sjain Jul 28 '14 at 13:58
  • I tried but same result,I can't see in the library list. – Tolgay Toklar Jul 28 '14 at 13:59
  • After copying the project into your workspace, you need to follow `Import -> Existing Projects into Workspace` and then import it. It is working in my system. – sjain Jul 28 '14 at 14:23
  • It is importing but I can't add as a library to my project.That is the problem – Tolgay Toklar Jul 28 '14 at 14:25
  • Because this is not the android project to import. As I said, once you created the new project with any name then just copy all the files from your `socket.io-java-client` project folder to that new project folder. This hack will work. I did the same. See the image in my answer. – sjain Jul 28 '14 at 14:29
  • To be particular, just copy the libs and src folder of your socket project to the new project. – sjain Jul 28 '14 at 14:31