Skip to content
徐昊 edited this page Dec 18, 2018 · 7 revisions

Gradle Integration

  • Add the following configuration to the build.gradle file under the project project.
allprojects {
    repositories {
        jcenter()
    }
}
  • Make sure you have already done with put JCenter into repositories blocking in project Gradle files than you need to add the following configuration to the module's build.gradle file.
dependencies {
	//Basic Socket client functionality
	api 'com.tonystark.android:socket:latest.release'//you can specify version
	//If you want to use server functionality, you need to compile the following libraries
	api 'com.tonystark.android:socket-server:latest.release'//you can specify version
}

Maven Integration

<!--Basic Socket client functionality-->
<dependency>
  <groupId>com.tonystark.android</groupId>
  <artifactId>socket</artifactId>
  <version>you can specify version</version>
  <type>pom</type>
</dependency>

<!--If you want to use server functionality, you need to compile the following libraries-->
<dependency>
  <groupId>com.tonystark.android</groupId>
  <artifactId>socket-server</artifactId>
  <version>you can specify version</version>
  <type>pom</type>
</dependency>

If it is an Android app, you need to declare permissions

  • Put the Permissions into AndroidManifest.xml file:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Proguard Configuration

  • Put this code into your Proguard file:
-dontwarn com.xuhao.didi.socket.client.**
-dontwarn com.xuhao.didi.socket.common.**
-dontwarn com.xuhao.didi.socket.server.**
-dontwarn com.xuhao.didi.core.**

-keep class com.xuhao.didi.socket.client.** { *; }
-keep class com.xuhao.didi.socket.common.** { *; }
-keep class com.xuhao.didi.socket.server.** { *; }
-keep class com.xuhao.didi.core.** { *; }

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}
-keep class com.xuhao.didi.socket.client.sdk.client.OkSocketOptions$* {
    *;
}
-keep class com.xuhao.didi.socket.server.impl.OkServerOptions$* {
    *;
}