Comments (4)
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.
Hi, I do follow the instructions:
- Clone the repository.
- cd kmqtt
- chmod +x ./gradlew
- ./gradlew :kmqtt-common:publishToMavenLocal
- ./gradlew :kmqtt-client:publishToMavenLocal
- Replace the GitHub maven block with mavenLocal() in the repositories block in your build.gradle.kts file.
- Update my build.gradle.kts
- 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.
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.
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)
- Can we use it in Android App as a background process? HOT 1
- Suggestions HOT 7
- Can we compile this code for android and iOS ? HOT 1
- HTTP header matching should be case insensitive to support more clients HOT 2
- Kotlin native could not find "openssl" HOT 8
- Can't download iOS dependencies (KMM) HOT 19
- Can't use client library for macos arm 64 HOT 4
- Recurring crash of Client on JVM HOT 1
- Seeking help HOT 1
- Can't subscribe to topics after invoking client.run() HOT 5
- connect to activemq HOT 6
- no default value for publishReceived
- callback for connect / disconnect & manage LWT HOT 2
- Artifact publication on Maven Central? HOT 3
- iOSBuild failed with Could not find 'openssl-its-simulator-arm64' HOT 2
- ssl server certificate not found (IOS only) HOT 4
- Failing to compile with Kotlin and Gradle KTS HOT 4
- "Unable to parse TLS packet header"-error caused by 0-byte-channel-read HOT 4
- Username and Password in the PacketInterceptor HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kmqtt.