appmattus / certificatetransparency

Certificate transparency for Android and JVM
Apache License 2.0
142 stars 29 forks source link

Desugaring and AGP version related crash #115

Open gnair03 opened 2 months ago

gnair03 commented 2 months ago

@mattmook IMPORTANT

I am on v2.4.0 of the appmattus/certificateTransparency library. We use Android Gradle plugin v7.4.2 and

With the above configuration - the app crashes on Android versions 5/6/7 with ClassNotFoundException as follows: Fatal Exception: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/time/Duration; at o.onStartNestedScroll.<clinit>(SourceFile:137) at o.onNestedScroll.valueOf(SourceFile:127) at o.onNestedScroll.InstrumentAction(SourceFile:119) at o.isMatchConstraintEqualityCandidate$Instrument.valueOf(SourceFile:16) The java.time package used in the LogListCacheManagementDataSource class is the root cause

I found out that not having the desugaring dependency has caused this issue and hence added the desugaring dependency as follows: coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'

Post this, the app started crashing with another exception as shown below: instabug_crashlog

On further debugging, I found the below 2 links - Google Issue Tracker AGP fix changelog: https://developer.android.com/studio/releases/fixed-bugs/studio/2022.3.1#android-studio-giraffe-canary-11-2022.3.1.11

The crash is related to Desugaring version incompatibility with the AGP version we use. The solution seems to be hinting towards upgrading AGP to 8.1.0+. But this involves a major upgrade of Android 17 as well, increasing the scope of the fix.

Is there any easier way to solve for this crash without having to do all these upgrades? Pls let us know.

gnair03 commented 2 months ago

@mattmook : Pls help me with this as soon as you can. We cannot rollout to a wider audience because of this issue.

gnair03 commented 2 months ago

@mattmook - This is super important to us and our subsequent releases. Pls let me know if there is any quick fix that can be adopted, without going thru the heavy-duty upgrades.

gnair03 commented 2 months ago

@mattmook - Pls help me with this issue, We have disabled CT on 5/6/7 for now. But we want to enable it back again, which requires fixing this asap. Pls help

gnair03 commented 2 months ago

@mattmook - Pls respond!

mattmook commented 2 months ago

from a point of view of removing dependency on desugaring it requires rewriting any code that uses features of Duration that don't exist on earlier versions of Android. It's certainly possible, but a complete pain.