Skip to content

chargebee exception from server:java.lang.Class cannot be cast to java.lang.reflect.Parameterized after updating AGP #106

@dkbast

Description

@dkbast

We encountered an issue where after upgrading our Flutter project to the latest AGP version, we could no longer make purchases in our "production" environment, while everything was working as expected when running the app locally.

Using adb logcat we found this error message:

chargebee exception from server:java.lang.Class cannot be cast to java.lang.reflect.Parameterized

Which lead us to retrofit and this issue square/retrofit#3751 - it is suggested there to add the proguard rules to any package consuming retrofit (square/retrofit#3751 (comment)) in the consumer rules.

We were able to resolve our issues by adding this to our (Flutter) apps rule file, but I believe it should be addressed in this package:

# With R8 full mode generic signatures are stripped for classes that are not
# kept. Suspend functions are wrapped in continuations where the type argument
# is used.
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation


# R8 full mode strips generic signatures from return types if not kept.
-if interface * { @retrofit2.http.* public *** *(...); }
-keep,allowoptimization,allowshrinking,allowobfuscation class <3>


# With R8 full mode generic signatures are stripped for classes that are not kept.
-keep,allowobfuscation,allowshrinking class retrofit2.Response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions