dixahq / dixa-messenger-react-native-demo

This is the Dixa messenger React Native Demo
Apache License 2.0
1 stars 1 forks source link

Android app crash when including dixa android #9

Open bradherman opened 11 months ago

bradherman commented 11 months ago

Android app crashes due to the following when including the implementation('com.dixa:messenger-sdk:1.3.2') in build.gradle:

FATAL EXCEPTION: OkHttp Dispatcher
                                                                                                    Process: com.jeevz.jeevz, PID: 6825
                                                                                                    java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/internal/Util;
                                                                                                        at okhttp3.JavaNetCookieJar.decodeHeaderAsJavaNetCookies(JavaNetCookieJar.kt:81)
                                                                                                        at okhttp3.JavaNetCookieJar.loadForRequest(JavaNetCookieJar.kt:59)
                                                                                                        at com.facebook.react.modules.network.ReactCookieJarContainer.loadForRequest(ReactCookieJarContainer.java:44)
                                                                                                        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:74)
                                                                                                        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
                                                                                                        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:65)
                                                                                                        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
                                                                                                        at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:205)
                                                                                                        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:533)
                                                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
                                                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
                                                                                                        at java.lang.Thread.run(Thread.java:1012)
                                                                                                    Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.internal.Util" on path: DexPathList[[zip file "/data/app/~~keOCHqJYcr1UxTBM0AerbA==/com.jeevz.jeevz-ZD5S8zODfBEGNwcnD2IvEg==/base.apk"],nativeLibraryDirectories=[/data/app/~~keOCHqJYcr1UxTBM0AerbA==/com.jeevz.jeevz-ZD5S8zODfBEGNwcnD2IvEg==/lib/arm64, /data/app/~~keOCHqJYcr1UxTBM0AerbA==/com.jeevz.jeevz-ZD5S8zODfBEGNwcnD2IvEg==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
                                                                                                        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
                                                                                                        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
                                                                                                        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                                                                                                        at okhttp3.JavaNetCookieJar.decodeHeaderAsJavaNetCookies(JavaNetCookieJar.kt:81) 
                                                                                                        at okhttp3.JavaNetCookieJar.loadForRequest(JavaNetCookieJar.kt:59) 
                                                                                                        at com.facebook.react.modules.network.ReactCookieJarContainer.loadForRequest(ReactCookieJarContainer.java:44) 
                                                                                                        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:74) 
                                                                                                        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) 
                                                                                                        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:65) 
                                                                                                        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) 
                                                                                                        at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:205) 
                                                                                                        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:533) 
                                                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137) 
                                                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) 
                                                                                                        at java.lang.Thread.run(Thread.java:1012) 
2023-08-16 17:57:46.563  6825-6983  AndroidRuntime          com.jeevz.jeevz                      E  FATAL EXCEPTION: OkHttp Dispatcher
                                                                                                    Process: com.jeevz.jeevz, PID: 6825
                                                                                                    java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/internal/Util;
                                                                                                        at okhttp3.JavaNetCookieJar.decodeHeaderAsJavaNetCookies(JavaNetCookieJar.kt:81)
                                                                                                        at okhttp3.JavaNetCookieJar.loadForRequest(JavaNetCookieJar.kt:59)
                                                                                                        at com.facebook.react.modules.network.ReactCookieJarContainer.loadForRequest(ReactCookieJarContainer.java:44)
                                                                                                        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:74)
                                                                                                        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
                                                                                                        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:65)
                                                                                                        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
                                                                                                        at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:205)
                                                                                                        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:533)
                                                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
                                                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
                                                                                                        at java.lang.Thread.run(Thread.java:1012)
                                                                                                    Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.internal.Util" on path: DexPathList[[zip file "/data/app/~~keOCHqJYcr1UxTBM0AerbA==/com.jeevz.jeevz-ZD5S8zODfBEGNwcnD2IvEg==/base.apk"],nativeLibraryDirectories=[/data/app/~~keOCHqJYcr1UxTBM0AerbA==/com.jeevz.jeevz-ZD5S8zODfBEGNwcnD2IvEg==/lib/arm64, /data/app/~~keOCHqJYcr1UxTBM0AerbA==/com.jeevz.jeevz-ZD5S8zODfBEGNwcnD2IvEg==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
                                                                                                        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
                                                                                                        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
                                                                                                        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                                                                                                        at okhttp3.JavaNetCookieJar.decodeHeaderAsJavaNetCookies(JavaNetCookieJar.kt:81) 
                                                                                                        at okhttp3.JavaNetCookieJar.loadForRequest(JavaNetCookieJar.kt:59) 
                                                                                                        at com.facebook.react.modules.network.ReactCookieJarContainer.loadForRequest(ReactCookieJarContainer.java:44) 
                                                                                                        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:74) 
                                                                                                        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) 
                                                                                                        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:65) 
                                                                                                        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) 
                                                                                                        at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:205) 
                                                                                                        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:533) 
                                                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137) 
                                                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) 
                                                                                                        at java.lang.Thread.run(Thread.java:1012) 
idortulov commented 10 months ago

@bradherman You need to add the dependency for okhttp:

implementation 'com.squareup.okhttp3:okhttp:3.6.0'
professorkolik commented 10 months ago

@idortulov In RN 0.72.3 OKHTTP_VERSION is 4.9.2, do you think it's safe to downgrade it?

for me acceptable solution was to have following

configurations.all {
    resolutionStrategy.force 'com.squareup.okhttp3:okhttp:4.9.2'
    resolutionStrategy.force 'com.squareup.okhttp3:okhttp-urlconnection:4.9.2'
}

with using the same version as RN

idortulov commented 10 months ago

Yes, this is also acceptable. The root issue was the missing dependency.

professorkolik commented 10 months ago

@idortulov would be nice to mention it in Readme and update example app 🙏

Nederby commented 9 months ago

@professorkolik I am more than happy to accept the change to the example app and to the readme file.

yakupdurmus commented 3 months ago

@idortulov In RN 0.72.3 OKHTTP_VERSION is 4.9.2, do you think it's safe to downgrade it?

for me acceptable solution was to have following

configurations.all {
    resolutionStrategy.force 'com.squareup.okhttp3:okhttp:4.9.2'
    resolutionStrategy.force 'com.squareup.okhttp3:okhttp-urlconnection:4.9.2'
}

with using the same version as RN

I made this change, I can start the first chat on Android side, When I answer on the web pannel I get a network error. Logcat output is as follows.

 E   Throwable: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jsoup/Jsoup;
                                                                                                        at com.dixa.messenger.ofs.n6.b(Unknown Source:6)
                                                                                                        at com.dixa.messenger.ofs.L1.a(Unknown Source:242)
                                                                                                        at com.dixa.messenger.ofs.L1.a(SourceFile:3)
                                                                                                        at com.dixa.messenger.ofs.f2$c$a.emit(Unknown Source:71)
                                                                                                        at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit(Emitters.kt:224)
                                                                                                        at com.dixa.messenger.ofs.R2$b$a.emit(Unknown Source:72)
                                                                                                        at kotlinx.coroutines.flow.StateFlowImpl.collect(StateFlow.kt:398)
                                                                                                        at kotlinx.coroutines.flow.StateFlowImpl$collect$1.invokeSuspend(Unknown Source:15)
                                                                                                        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                                                                                                        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
                                                                                                        at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
                                                                                                        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
                                                                                                    Caused by: java.lang.ClassNotFoundException: Didn't find class "org.jsoup.Jsoup" on path: DexPathList[[zip file "/data/app/~~66WDdaAFLCigxSeCC5qprQ==/com.justmop.partner-DW8QuXFq22oBODH0Nvf-Rw==/base.apk"],nativeLibraryDirectories=[/data/app/~~66WDdaAFLCigxSeCC5qprQ==/com.justmop.partner-DW8QuXFq22oBODH0Nvf-Rw==/lib/arm64, /data/app/~~66WDdaAFLCigxSeCC5qprQ==/com.justmop.partner-DW8QuXFq22oBODH0Nvf-Rw==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
                                                                                                        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
                                                                                                        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
                                                                                                        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                                                                                                        at com.dixa.messenger.ofs.n6.b(Unknown Source:6) 
                                                                                                        at com.dixa.messenger.ofs.L1.a(Unknown Source:242) 
                                                                                                        at com.dixa.messenger.ofs.L1.a(SourceFile:3) 
                                                                                                        at com.dixa.messenger.ofs.f2$c$a.emit(Unknown Source:71) 
                                                                                                        at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit(Emitters.kt:224) 
                                                                                                        at com.dixa.messenger.ofs.R2$b$a.emit(Unknown Source:72) 
                                                                                                        at kotlinx.coroutines.flow.StateFlowImpl.collect(StateFlow.kt:398) 
                                                                                                        at kotlinx.coroutines.flow.StateFlowImpl$collect$1.invokeSuspend(Unknown Source:15) 
                                                                                                        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 
                                                                                                        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) 
                                                                                                        at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42) 
                                                                                                        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95) 
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) 
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) 
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) 
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) 
yakupdurmus commented 3 months ago

@idortulov In RN 0.72.3 OKHTTP_VERSION is 4.9.2, do you think it's safe to downgrade it? for me acceptable solution was to have following

configurations.all {
    resolutionStrategy.force 'com.squareup.okhttp3:okhttp:4.9.2'
    resolutionStrategy.force 'com.squareup.okhttp3:okhttp-urlconnection:4.9.2'
}

with using the same version as RN

I made this change, I can start the first chat on Android side, When I answer on the web pannel I get a network error. Logcat output is as follows.

 E   Throwable: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jsoup/Jsoup;
                                                                                                      at com.dixa.messenger.ofs.n6.b(Unknown Source:6)
                                                                                                      at com.dixa.messenger.ofs.L1.a(Unknown Source:242)
                                                                                                      at com.dixa.messenger.ofs.L1.a(SourceFile:3)
                                                                                                      at com.dixa.messenger.ofs.f2$c$a.emit(Unknown Source:71)
                                                                                                      at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit(Emitters.kt:224)
                                                                                                      at com.dixa.messenger.ofs.R2$b$a.emit(Unknown Source:72)
                                                                                                      at kotlinx.coroutines.flow.StateFlowImpl.collect(StateFlow.kt:398)
                                                                                                      at kotlinx.coroutines.flow.StateFlowImpl$collect$1.invokeSuspend(Unknown Source:15)
                                                                                                      at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                                                                                                      at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
                                                                                                      at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
                                                                                                      at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
                                                                                                      at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
                                                                                                      at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
                                                                                                      at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
                                                                                                      at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
                                                                                                    Caused by: java.lang.ClassNotFoundException: Didn't find class "org.jsoup.Jsoup" on path: DexPathList[[zip file "/data/app/~~66WDdaAFLCigxSeCC5qprQ==/com.justmop.partner-DW8QuXFq22oBODH0Nvf-Rw==/base.apk"],nativeLibraryDirectories=[/data/app/~~66WDdaAFLCigxSeCC5qprQ==/com.justmop.partner-DW8QuXFq22oBODH0Nvf-Rw==/lib/arm64, /data/app/~~66WDdaAFLCigxSeCC5qprQ==/com.justmop.partner-DW8QuXFq22oBODH0Nvf-Rw==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
                                                                                                      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
                                                                                                      at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
                                                                                                      at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                                                                                                      at com.dixa.messenger.ofs.n6.b(Unknown Source:6) 
                                                                                                      at com.dixa.messenger.ofs.L1.a(Unknown Source:242) 
                                                                                                      at com.dixa.messenger.ofs.L1.a(SourceFile:3) 
                                                                                                      at com.dixa.messenger.ofs.f2$c$a.emit(Unknown Source:71) 
                                                                                                      at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit(Emitters.kt:224) 
                                                                                                      at com.dixa.messenger.ofs.R2$b$a.emit(Unknown Source:72) 
                                                                                                      at kotlinx.coroutines.flow.StateFlowImpl.collect(StateFlow.kt:398) 
                                                                                                      at kotlinx.coroutines.flow.StateFlowImpl$collect$1.invokeSuspend(Unknown Source:15) 
                                                                                                      at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 
                                                                                                      at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) 
                                                                                                      at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42) 
                                                                                                      at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95) 
                                                                                                      at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) 
                                                                                                      at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) 
                                                                                                      at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) 
                                                                                                      at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) 

Instead of this change, I excluded okhttp3 and implemented org.jsoup:jsoup:1.16.1 as follows. it worked for me

    implementation 'org.jsoup:jsoup:1.16.1'
    implementation ('com.dixa:messenger-sdk:1.5.4'){
        exclude group:'com.squareup.okhttp3', module:'okhttp'
    }