Code Monkey home page Code Monkey logo

Comments (4)

davidepianca98 avatar davidepianca98 commented on June 4, 2024

Hello, please try to accurately follow the instructions provided in the Readme here https://github.com/davidepianca98/KMQTT#gradle. The setup process is a bit tedious but for now there's not much I can do about it. If you are still having problems, please provide the full build.gradle.kts.

KMQTT supports Android because it runs on the JVM.

from kmqtt.

bigcat26 avatar bigcat26 commented on June 4, 2024

Hi, I do follow the instructions:

  1. Clone the repository.
  2. cd kmqtt
  3. chmod +x ./gradlew
  4. ./gradlew :kmqtt-common:publishToMavenLocal
  5. ./gradlew :kmqtt-client:publishToMavenLocal
  6. Replace the GitHub maven block with mavenLocal() in the repositories block in your build.gradle.kts file.
  7. Update my build.gradle.kts
  8. Gradle sync successful.
root build.gradle.kts (partial)

allprojects {
    repositories {
        google()
        mavenLocal()
        mavenCentral()
        maven("https://jitpack.io")
    }
}

module build.gradle.kts (partial)

kotlin {
    androidTarget()
    iosX64(),
    iosArm64(),
    iosSimulatorArm64()

    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation("com.github.davidepianca98:kmqtt-common:0.4.2")
                implementation("com.github.davidepianca98:kmqtt-client:0.4.2")
                
                implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${property("kotlin.corutines.version")}")
                implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
                implementation("org.jetbrains.kotlinx:kotlinx-serialization-cbor:1.3.1")
                implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2")
                implementation("io.ktor:ktor-network:${property("ktor.version")}")
                implementation("io.ktor:ktor-client-cio:${property("ktor.version")}")
                implementation("io.ktor:ktor-client-websockets:${property("ktor.version")}")
                implementation("com.squareup.okio:okio:3.2.0")
            }
        }

        val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
                implementation("org.mockito:mockito-core:5.3.1")
                implementation("org.mockito.kotlin:mockito-kotlin:4.1.0")
                implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${property("kotlin.corutines.version")}")
            }
        }

        val androidMain by getting {
            dependencies {
                api(fileTree("libs") { include("*.jar") })
                implementation("org.jetbrains.kotlinx:kotlinx-coroutines-rx3:${property("kotlin.corutines.version")}")
                implementation("io.ktor:ktor-client-android:${property("ktor.version")}")
            }
        }

        val androidUnitTest by getting {}

        val androidInstrumentedTest by getting {
            dependsOn(androidMain)
            dependencies {
                implementation(kotlin("test"))
                implementation("org.mockito:mockito-core:5.3.1")
                implementation("org.mockito.kotlin:mockito-kotlin:4.1.0")
                implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${property("kotlin.corutines.version")}")

                implementation("androidx.test:rules:1.5.0")
                implementation("androidx.test.ext:junit:1.1.5")
                implementation("androidx.test.espresso:espresso-core:3.5.1")
            }
        }

        val iosX64Main by getting
        val iosArm64Main by getting
        val iosSimulatorArm64Main by getting
        val iosMain by creating {
            dependsOn(commonMain)
            iosX64Main.dependsOn(this)
            iosArm64Main.dependsOn(this)
            iosSimulatorArm64Main.dependsOn(this)
            dependencies {
                implementation("io.ktor:ktor-client-darwin:${property("ktor.version")}")
            }
        }

        val iosX64Test by getting
        val iosArm64Test by getting
        val iosSimulatorArm64Test by getting
        val iosTest by creating {
            dependsOn(commonTest)
            dependsOn(iosMain)
            iosX64Test.dependsOn(this)
            iosArm64Test.dependsOn(this)
            iosSimulatorArm64Test.dependsOn(this)
        }

    }
}

from kmqtt.

davidepianca98 avatar davidepianca98 commented on June 4, 2024

Please try to clone the latest version again if you aren't downloading at the latest release tag, there was an error. Then the command would be ./gradlew publishToMavenLocal. I have tried with a build.gradle.kts similar to yours, at least with the same targets and I could call MQTTClient from the common code.

from kmqtt.

bigcat26 avatar bigcat26 commented on June 4, 2024

Please try to clone the latest version again if you aren't downloading at the latest release tag, there was an error. Then the command would be ./gradlew publishToMavenLocal. I have tried with a build.gradle.kts similar to yours, at least with the same targets and I could call MQTTClient from the common code.

thank you, it works.

from kmqtt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.