helpcrunch / android-sdk-demo

Public demo for HelpCrunch Android SDK
Apache License 2.0
9 stars 1 forks source link

Duplicate class a.a.a.a found in modules #33

Closed nostra13 closed 3 years ago

nostra13 commented 3 years ago

I use several libs which are obfuscated. As a result I get following build error:

Duplicate class a.a.a.a found in modules jetified-chat-sdk-3.0.7-runtime (com.helpcrunch:chat-sdk:3.0.7) and jetified-other-lib-runtime (other-lib.aar)

because other lib also has obfuscated a.a.a.a class.

Please use flattenpackagehierarchy in your ProGuard rules to move obfuscated classes in some unique package to prevent aforementioned conflicts with other libraries.

Same type issue was there - https://github.com/Adyen/adyen-3ds2-android/issues/14

TalbotGooday commented 3 years ago

Hello! That's a grate idea, thanks! I'll create a new 3.0.8-rc.03 version with this feature

nostra13 commented 3 years ago

@TalbotGooday Can you specify when 3.0.8-rc.03 will be available?

TalbotGooday commented 3 years ago

Tomorrow night, I think. If the passage of time is critical to you, then I can create a snapshot version for you so that you can check compatibility

nostra13 commented 3 years ago

I'll be grateful for snapshot.

TalbotGooday commented 3 years ago

Okay. Give me a half of hour :+1:

TalbotGooday commented 3 years ago

Sorry, build problems. I can not upload the repository to the maven. Please wait until tomorrow :с

nostra13 commented 3 years ago

Any news?

TalbotGooday commented 3 years ago

Hi! Sorry for the long answer. Yeah, you can check the snapshot version.

Please, add this to the root gradle:

allprojects {
    repositories {
        ...
        maven {
            url "https://oss.sonatype.org/content/repositories/snapshots/"
        }
    }
}

and here is the snapshot build:

implementation('com.helpcrunch:chat-sdk:3.0.8-rc.03-s.84-SNAPSHOT')
nostra13 commented 3 years ago

Something was changed with okhttp version in 3.8.0-rc.01? There was no this error in 3.8.0-alpha.04.

Could not determine the dependencies of task ':app:compileDebugKotlin'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve com.squareup.okhttp3:okhttp:4.9.1.
     Required by:
         project :app
         project :app > com.squareup.okhttp3:logging-interceptor:4.9.1
      > Cannot find a version of 'com.squareup.okhttp3:okhttp' that satisfies the version constraints:
           Dependency path 'e-client:app:unspecified' --> 'com.squareup.okhttp3:okhttp:4.9.1'
           Dependency path 'e-client:app:unspecified' --> 'com.squareup.picasso:picasso:2.8' --> 'com.squareup.okhttp3:okhttp:3.10.0'
           Dependency path 'e-client:app:unspecified' --> 'com.helpcrunch:chat-sdk:3.0.8-rc.03-s.84-SNAPSHOT' --> 'com.squareup.okhttp3:okhttp:{strictly 3.12.12}'
           Dependency path 'e-client:app:unspecified' --> 'com.squareup.okhttp3:logging-interceptor:4.9.1' --> 'com.squareup.okhttp3:okhttp:4.9.1'
           Dependency path 'e-client:app:unspecified' --> 'com.squareup.retrofit2:retrofit:2.9.0' --> 'com.squareup.okhttp3:okhttp:3.14.9'
           Dependency path 'e-client:app:unspecified' --> 'com.tinder.scarlet:websocket-okhttp:0.1.10' --> 'com.squareup.okhttp3:okhttp:3.11.0'
           Dependency path 'e-client:app:unspecified' --> 'com.helpcrunch:chat-sdk:3.0.8-rc.03-s.84-SNAPSHOT' --> 'io.socket:engine.io-client:1.0.0' --> 'com.squareup.okhttp3:okhttp:3.8.1'
           Dependency path 'e-client:app:unspecified' --> 'com.helpcrunch:chat-sdk:3.0.8-rc.03-s.84-SNAPSHOT' --> 'io.coil-kt:coil:1.1.1' --> 'io.coil-kt:coil-base:1.1.1' --> 'com.squareup.okhttp3:okhttp:3.12.12'
TalbotGooday commented 3 years ago

Nope, nothing changed. OkHttp version is still strictly 3.12.12. The logging-interceptor is also strictly 3.12.12. You can try to downgrade the OkHttp and the logging-interceptor to v 3.12.12 if you are not using some features from the new versions

nostra13 commented 3 years ago

It's weird because as 3.8.0-alpha.04 has no such issue.

Anyway I forced okhttp version on my side and checked class conflicts - they are gone. 3.0.8-rc.03-s.84-SNAPSHOT fixed the issue, looking forward to 3.0.8 release.

TalbotGooday commented 3 years ago

I'm glad the problem was solved. :+1: I'm also looking forward to version 3.0.8, but we have a shortage of testers right now. :sweat_smile: Do you have any familiar testers in Kiev? :sweat_smile:

nostra13 commented 3 years ago

So you're saying not enough testers immigrated from Minsk to Kiev yet?)

TalbotGooday commented 3 years ago

My friends, testers from Belarus, do not emigrate. They test the strength of the authorities :sweat_smile:

nostra13 commented 3 years ago

Rare case when everybody wants the system to crash)

nostra13 commented 3 years ago

@TalbotGooday I got following crash on app start (3.0.8-rc.03-s.84-SNAPSHOT):

Fatal Exception: java.io.IOException: wrong domain
       at com.helpcrunch.library.g.a.intercept(HostSelectionInterceptor.kt:17)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
       at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
       at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)

Galaxy S10 Lite, Galaxy A51, Android 11

Should I create separate issue for that?

TalbotGooday commented 3 years ago

No, I'll check what is wrong. Could you please tell me how did you get this error?

nostra13 commented 3 years ago

I guess it happened after HelpCrunch.logout() call on app start. I can't reproduce this crash (got only crash reports) but maybe it's specific for Samsung.

TalbotGooday commented 3 years ago

Got it, thank you! I'll check)

nostra13 commented 3 years ago

Will any fix for this be released?

TalbotGooday commented 3 years ago

Unfortunately, not yet. I believe the stable version will be released towards the end of the week with all the fixes :+1:

TalbotGooday commented 3 years ago

Hi there! The v3.0.8 is already available :+1:

nostra13 commented 3 years ago

@TalbotGooday Still got crashes on v3.0.8 after HelpCrunch.logout():

java.io.IOException: wrong domain
        at com.helpcrunch.library.g.a.intercept(HostSelectionInterceptor.kt:17)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)
TalbotGooday commented 3 years ago

Weird. Could you please give me some code example or some demo app? I can't reproduce this error

nostra13 commented 3 years ago

Can't reproduce it anymore, have no stable steps. I will try to find out some reproducing steps.

TalbotGooday commented 3 years ago

Got it! I will be very appreciate!

nostra13 commented 3 years ago

Found out the reproducing steps of aforementioned crash: if HelpCrunch is not initialized before then HelpCrunch.logout() crashes an app with java.io.IOException: wrong domain.

Fix for clients: add check if (HelpCrunch.isInitialized()) HelpCrunch.logout().

But you also can consider to add some check into the lib to prevent this crash.

TalbotGooday commented 3 years ago

It makes sense. You are gorgeous! Thank you! I'll add this check inside the logout method

gokulsukumar03 commented 1 year ago

-repackageclasses 'com.your.package'

Add this rule in the proguard file, a.a.a.a duplicate issue get resolve.

ProGuard will rename the classes and resources within the specified package to obfuscate them. This helps to make the code more difficult to understand and reverse engineer, improving the security of your Android application.