Initial setup

For CometChat SDK version 1.6

CometChat SDK v1.6 supports only Android studio for developing apps and the sdk file is cometchat-sdk.aar. To integrate the sdk in Android studio please follow the following steps:

  • Create new module from File->New module
  • Select Import .JAR or .AAR package option
  • Select the cometchat-sdk.aar file and click finish
  • Go to File->Project Structure, add module dependency cometchat-sdk
  • Add following dependency to your build.gradle of your app and sync the gradle

    compile 'com.google.code.gson:gson:2.3'
    compile 'com.pnikosis:materialish-progress:1.5'
    compile 'com.mcxiaoke.volley:library:1.0.17'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'org.jsoup:jsoup:1.8.1'
    compile 'org.apache.httpcomponents:httpcore:4.3.2'
    compile 'org.apache.httpcomponents:httpmime:4.3.3'
    compile 'com.parse.bolts:bolts-tasks:1.4.0'
    compile 'com.commit451:PhotoView:1.2.4'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.splitwise:tokenautocomplete:1.3.3'

    For CometChat SDK version 1.5.2 and below

    Copy the cometchat-sdk.jar into the ‘libs’ folder of your Android project.
    Right click and add it to the build path.

    use-cometchat-sdk

    External Dependencies

  • gson-2.2.4.jar
  • jsoup-1.7.3.jar
  • Volley (You can find a compiled version of Volley in our Sample App)
  • httpmime-4.1.3 onwards(for SDK 1.5.1 onwards)
  • Permissions
    Add following permissions in your AndroidManifest.xml file

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    Not finding what you need?

    The CometChat team is here to help!