chat-sdk / chat-sdk-android

Chat SDK Android - Open Source Mobile Messenger
https://chatsdk.co
Other
1.61k stars 611 forks source link

SDK Integration issue #726

Closed vivdub closed 2 years ago

vivdub commented 2 years ago

While integration the SDK as per instructions provided it is not being able to resolve.

Below is the app, build.gradle

`plugins { id 'com.android.application' id 'kotlin-android' id 'com.google.gms.google-services' }

android { compileSdk 31

defaultConfig {
    applicationId "com.pring"
    minSdk 21
    targetSdk 31
    versionCode 1
    versionName "1.0"
    multiDexEnabled = true

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
    jvmTarget = '1.8'
}

}

dependencies {

implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

implementation 'sdk.chat:firebase-app:5.3.11'
implementation 'sdk.chat:firestream-app:5.3.11'
implementation platform('com.google.firebase:firebase-bom:29.0.3')

}`

Here is the project build.gradle

`buildscript { repositories { google() mavenCentral() jcenter() maven { url 'https://jitpack.io' } maven { url "https://chatsdk.jfrog.io/artifactory/release/chat-sdk-android" } maven { url "https://chatsdk.jfrog.io/artifactory/release/chatkit" } maven { url "https://chatsdk.jfrog.io/artifactory/release/matisse" } } dependencies { classpath "com.android.tools.build:gradle:7.0.4" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10" classpath "com.google.gms:google-services:4.3.3"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

task clean(type: Delete) { delete rootProject.buildDir } `

The error I get is:

Failed to resolve: sdk.chat:firestream-app:5.3.11 Failed to resolve: sdk.chat:firebase-app:5.3.11

I have tried with 5.3.17 version also.

Please help

bensmiley commented 2 years ago

Can you try with 5.4.2? As per:

https://chat-sdk.gitbook.io/android/setup/add-chat-sdk-to-your-project

Otherwise, can you try downloading this project:

https://github.com/chat-sdk/chat-sdk-android-example

And see if it compiles? It is using gradle. If it does compile, you can compare it to your project to see what the issue is.

vivdub commented 2 years ago

Thanks for replying back. This complete github project does works.

When I use the independent projects in my own, locally, I still get some issues. The first issue that I am facing is :

Plugin [id: "com.jfrog.artifactory"] was not found in any of the following sources:

This is present in chat-sdk-core/build.gradle

I added: maven { url "https://plugins.gradle.org/m2/" }

but it's of no use.

bensmiley commented 2 years ago

@vivdub I have verified the setup instructions and if they are followed correctly, they result in a project that does build. Since the Github project works, it looks like something in your Gradle setup is not correct.

Some points:

Make sure your allProjects block in the project-level build.gralde looks like this:

allprojects {
    repositories {
        google()
        mavenCentral()

        maven { url 'https://jitpack.io' }
        maven { url "https://chatsdk.jfrog.io/artifactory/release/chat-sdk-android" }
        maven { url "https://chatsdk.jfrog.io/artifactory/release/chatkit" }
        maven { url "https://chatsdk.jfrog.io/artifactory/release/matisse" }
        maven { url "https://chatsdk.jfrog.io/artifactory/release/material-search-view" }
        maven { url "https://chatsdk.jfrog.io/artifactory/release/android-image-cropper" }
    }
}

I've updated the steps here:

https://chat-sdk.gitbook.io/android/setup/add-chat-sdk-to-your-project

Also updated the example project to use 5.4.2:

https://github.com/chat-sdk/chat-sdk-android-example

Given that as far as I can see, the instructions are correct and the example project works fine, I'm closing this issue. You need to just compare the example project to your project to see where the problem is. If you need further help, you would need to buy priority support so I could fix your project myself (given that I can't go any further helping you without seeing your code).

vivdub commented 2 years ago

Seems to work. Thank you