NoClassDefFoundError: Failed resolution of: Lcom/microsoft/trouterclient/registration/ISkypetokenProvider - android

I'm trying to use azure chat and calling in the same application. Right now I'm getting an error
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/microsoft/trouterclient/registration/ISkypetokenProvider;
at com.azure.android.communication.chat.ChatAsyncClient.<init>(ChatAsyncClient.java:50)
at com.azure.android.communication.chat.ChatClientBuilder.buildAsyncClient(ChatClientBuilder.java:233)
https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/chat/get-started the QuickStart library suggested I exclude files from dependency like below and this is causing the issue I'm seeing.
implementation 'com.azure.android:azure-communication-calling:2.0.0'
implementation 'com.azure.android:azure-communication-common:1.0.1'
implementation 'org.slf4j:slf4j-log4j12:1.7.29'
implementation ("com.azure.android:azure-communication-chat:1.1.0-beta.4") {
exclude group: 'com.microsoft', module: 'trouter-client-android'
}
If I try to remove this though I will receive this error
Duplicate class com.skype.rt.WiFiNetworkState found in modules jetified-azure-communication-calling-2.0.0-runtime (com.azure.android:azure-communication-calling:2.0.0) and jetified-trouter-client-android-0.1.1-runtime (com.microsoft:trouter-client-android:0.1.1)
Am I using the wrong versions or is there a different solution to this?

Chat for azure can't work with the real time notification functionality in android as of that version.
https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/chat/get-started?tabs=windows&pivots=programming-language-android#receive-chat-messages-from-a-chat-thread

Related

How to import BigQuery (from Google) into a Android Kotlin project

Recently I started to develop and Android Kotlin project and I need to use the BigQuery library (from Google). According to the documentation, it not exists any client library developed in Kotlin but I reviewed the Java library so I decided to impor it...
When I put the gradle statement in app-module of my project:
implementation platform('com.google.cloud:libraries-bom:26.1.5')
implementation 'com.google.cloud:google-cloud-bigquery'
I got this ouput error:
Duplicate class org.jetbrains.annotations.NotNull found in modules annotations-13.0 (org.jetbrains:annotations:13.0) and auto-value-1.10 (com.google.auto.value:auto-value:1.10)
Duplicate class org.jetbrains.annotations.Nullable found in modules annotations-13.0 (org.jetbrains:annotations:13.0) and auto-value-1.10 (com.google.auto.value:auto-value:1.10)
Go to the documentation to learn how to Fix dependency resolution errors.
Could you help someone, please?
In order to solve it, I tried the following:
In build.gradle [app-module]:
configurations {
cleanedAnnotations
implementation.exclude group: 'org.jetbrains' , module:'annotations'
}
and
configurations {
cleanedAnnotations
implementation.exclude group:'com.google.auto.value' , module:'auto-value:1.10'
}
but still not working.
In build.gradle [app-module] in "android{}" section:
configurations.all {
resolutionStrategy {
exclude group: "org.jetbrains", module: "annotations-13.0"
}
}
but I didn't get any success....

java.lang.ClassNotFoundException: Didn't find class "io.ktor.client.HttpClientJvmKt"

I have create kotlin multiplatform project for handling API.
I integrated this in my main project but I am getting following exception.
java.lang.NoClassDefFoundError: Failed resolution of: Lio/ktor/client/HttpClientJvmKt;
I tried to add following dependencies in my main project still issue persists.
dependencies {
implementation "io.ktor:ktor-client-core:1.3.2"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.7"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:0.20.0"
}
packagingOptions {
exclude 'META-INF/kotlinx-io.kotlin_module'
exclude 'META-INF/atomicfu.kotlin_module'
exclude 'META-INF/kotlinx-coroutines-io.kotlin_module'
exclude 'META-INF/kotlinx-coroutines-core.kotlin_module'
}
Still I am getting this issue.
Any help would be appreciated.
In MPP you need to declare dependencies for each target.
For example:
commonMain needs to have the dependency you used above:
implementation "io.ktor:ktor-client-core:1.3.2"
androidMain needs to have it's own dependency:
implementation "io.ktor:ktor-client-okhttp:1.3.2"
iosMain also needs it's own dependency:
implementation "io.ktor:ktor-client-ios:1.3.2"
Note the suffix of ktor-client-xxxx.
So my guess is, you only need to replace the dependency in your main project to io.ktor:ktor-client-okhttp (or whichever client you prefer)

Firebase and Socket.io compatibility issue crash my app

Every time add firebase dependencies, run my app and socket connect to endpoint, my app crashes immediately.
I'm using firebase and socket.io together and is causing the crash due to compatibility issues. Can firebase and socket.io be used together?
I get the following error when i added firebase and try to connect to socket.io in my project
E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
Process: com.project.hubrydemanagerapp, PID: 30101
java.lang.NoSuchMethodError: No virtual method callEngineGetConnection(Lcom/squareup/okhttp/Call;)Lcom/squareup/okhttp/Connection; in class Lcom/squareup/okhttp/internal/Internal; or its super classes (declaration of 'com.squareup.okhttp.internal.Internal' appears in /data/app/com.project.hubrydemanagerapp-t3ZbPD-QZAE9y2BMT64Cdg==/base.apk!classes3.dex)
at com.squareup.okhttp.ws.WebSocketCall.createWebSocket(WebSocketCall.java:154)
at com.squareup.okhttp.ws.WebSocketCall.access$000(WebSocketCall.java:42)
at com.squareup.okhttp.ws.WebSocketCall$1.onResponse(WebSocketCall.java:102)
at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:177)
at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
My dependencies:
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.firebase:firebase-firestore:21.3.0'
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
implementation('com.github.nkzawa:socket.io-client:0.6.0') {
exclude group: 'org.json', module: 'json'
}
Endpoint
"https://hubryde-trip-service.herokuapp.com/";
"https://hubryde-request-service.herokuapp.com/";
Connection. I'm using Application class to create socket model.
tripSocket = IO.socket(TRIP_URL);
socket2 = IO.socket(BUS_URL);
SocketEndpoint app = (SocketEndpoint) getApplication();
tripSocket = app.getmTripSocket();
if(!tripSocket.connected()) {
tripSocket.connect();
}
socket2 = app.getmBusLocationSocket();
if(!socket2.connected()) {
socket2.connect();
}
}
Im also Using com.github.nkzawa:socket.io-client:0.6.0.
That crash also happened to me after adding firebase in app messaging module,
for me the quick fix (until this will be fixed, hopefully soon..)
was to add exclude..
hope it helps..
implementation ('com.google.firebase:firebase-inappmessaging-display:19.0.3') {
exclude group: 'com.squareup.okhttp', module: 'okhttp'
}
my full gradle file: (Using AndroidX)
implementation 'com.github.nkzawa:socket.io-client:0.6.0'
implementation 'tech.gusavila92:java-android-websocket-client:1.2.2'
implementation "com.google.firebase:firebase-messaging:20.1.4"
implementation 'com.google.firebase:firebase-core:17.3.0'
implementation 'com.google.firebase:firebase-analytics:17.3.0'
implementation 'com.google.firebase:firebase-auth:19.3.0'
implementation ('com.google.firebase:firebase-inappmessaging-display:19.0.3') {
exclude group: 'com.squareup.okhttp', module: 'okhttp'
}
I have tested your dependencies and i realized firestore dependency is the reason for the crash not the entire firebase dependencies. It seems not to support The type of socket.io you are using OR not even support socket.io at all.
I even went further to test older version of cloud firestore, but no luck - The app keeps crashing with the same error.
So remove firestore and sync your project if you will see the error.

Gradle "Duplicate class" error when adding uCrop and Cometchat libraries

When I add the UCrop library version 2.2.3 and Cometchat SDK version 1.6.+ I get the following error :
Duplicate class okhttp3.Address found in modules okhttp-3.11.0.jar (com.squareup.okhttp3:okhttp:3.11.0) and okhttp-3.12.0.jar (com.cometchat:pro-android-chat-sdk:1.6.0)
The problem is that none of the previously asked questions have answers that solved my problem because most of them use the 'compile' method which is now deprecated.
I read many questions here on stackoverflow about the same topic, including
this , this.
I've also tried excluding okhttp3 library from one of the packages so that only one is used , using
implementation('com.github.yalantis:ucrop:2.2.3' )
{
exclude group: 'com.cometchat', module: 'okhttp3'
}
I would appreciate it if someone could explain to me how excludes work in gradle and what's wrong with the code that I wrote.
Instead of excluding okhttp3 from com.cometchat group try doing this
implementation('com.cometchat:pro-android-chat-sdk:1.6.0') {
configurations {
compile.exclude module: 'okhttp'
}
}
The conflict is due to your both UCrop and CometChat dependencies internally uses okhttp library.To resolve this problem you have to exclude conflicting library.
Excluding transitive dependency can be done two different ways.
Exclude transitive dependency by configuration
Exclude transitive dependency by dependency
To read more about gradle dependency conflict cause and solution you can check out this link
https://www.concretepage.com/build-tools/gradle/gradle-exclude-transitive-dependency-example

Android app crashes when using these two together - OkHttpStack AND firebase firestore dependency

Android app crashes when i run these two things together - OkHttpStack as base stack for new request queue in volley and firebase firestore dependency in gradle ('com.google.firebase:firebase-firestore:17.0.5')
Gives me this error, maybe firebase firestore dependency already includes okhttp dependency that's why this coming or maybe its not, but if this is the case what to be done or how to exclude it? or Otherwise i am not getting what the error is, please suggest a solution.
Dependencies -
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
implementation 'com.google.firebase:firebase-firestore:17.0.5'
FATAL EXCEPTION: Thread-21
java.lang.NoSuchMethodError: No direct method <init>(Lcom/squareup/okhttp/OkHttpClient;Lcom/squareup/okhttp/Request;ZZZLcom/squareup/okhttp/Connection;Lcom/squareup/okhttp/internal/http/RouteSelector;Lcom/squareup/okhttp/internal/http/RetryableSink;Lcom/squareup/okhttp/Response;)V in class Lcom/squareup/okhttp/internal/http/HttpEngine; or its super classes (declaration of 'com.squareup.okhttp.internal.http.HttpEngine' appears in /data/app/packagename-vaVP5bn4ajPlEZQZDBqyVg==/split_lib_dependencies_apk.apk:classes2.dex)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.newHttpEngine(HttpURLConnectionImpl.java:362)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.initHttpEngine(HttpURLConnectionImpl.java:312)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:377)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:497)
at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
at com.android.volley.toolbox.HurlStack.executeRequest(HurlStack.java:96)
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:123)
at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:131)
at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)
UncaughtException: java.lang.NoSuchMethodError: No direct method <init>(Lcom/squareup/okhttp/OkHttpClient;Lcom/squareup/okhttp/Request;ZZZLcom/squareup/okhttp/Connection;Lcom/squareup/okhttp/internal/http/RouteSelector;Lcom/squareup/okhttp/internal/http/RetryableSink;Lcom/squareup/okhttp/Response;)V in class Lcom/squareup/okhttp/internal/http/HttpEngine; or its super classes (declaration of 'com.squareup.okhttp.internal.http.HttpEngine' appears in /data/app/packageName-vaVP5bn4ajPlEZQZDBqyVg==/split_lib_dependencies_apk.apk:classes2.dex)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.newHttpEngine(HttpURLConnectionImpl.java:362)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.initHttpEngine(HttpURLConnectionImpl.java:312)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:377)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:497)
at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
at com.android.volley.toolbox.HurlStack.executeRequest(HurlStack.java:96)
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:123)
at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:131)
at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)
Firestore depends on old okhttp:2.7.2, not okhttp3. It's even enother package, not just version. So you cant just exclude it from firestore dependencies. The only way I see here - you should switch to old version of okhttp until firestore update its dependencies.
There is a temporary fix at here
configurations.all {
resolutionStrategy {
force 'com.squareup.okhttp:okhttp:2.7.5'
force 'com.squareup.okio:okio:1.17.5'
}
}

Categories

Resources