Skip to content

enable R8, sdk report exception: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType #29

@edisonOSL

Description

@edisonOSL

Describe the bug
if enable R8,

        debug {
            minifyEnabled true // 启用混淆
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }

sdk will report exception: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType when create Risk instance.

To Reproduce
Steps to reproduce the behavior:

  1. enable R8
minifyEnabled true
  1. create Risk Instance
                    val riskInstance = Risk.getInstance(
                        context,
                        RiskConfig(
                            getPublicKey(),
                            getRiskEnvironment()
                        )
                    )

deviceDataService.getConfiguration() is a retrofit request, it will throw java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType when create Risk instance.
3. See error
Image

Smartphone (please complete the following information):

  • Device: [SM-S911U1]
  • OS: [Android 16]
  • Version [com.github.checkout:checkout-risk-sdk-android:2.1.0, com.squareup.retrofit2:retrofit:2.9.0, com.squareup.okhttp3:okhttp:4.12.0]

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