Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoSuchMethodError: No interface method getTypeName (API level 25) #25

Open
egorikftp opened this issue Apr 27, 2022 · 0 comments

Comments

@egorikftp
Copy link

egorikftp commented Apr 27, 2022

Hello, thanks for the library.
Recently I have faced with crash.

Steps to reproduce: add suspend function into ApiInterface

Looks like problem in this code block and method getTypeName not available on Android:

private fun isSuspendMethodWithListReturnValue(method: Method): Boolean {
            val lastParameter = method.genericParameterTypes.lastOrNull() as? ParameterizedType ?: return false
            if (!Continuation::class.java.isAssignableFrom(Class.forName(lastParameter.rawType.typeName))) {
                return false
            }
}

Crash log:

Process: com.theapache64.notes, PID: 29094
    java.lang.NoSuchMethodError: No interface method getTypeName()Ljava/lang/String; in class Ljava/lang/reflect/Type; or its super classes (declaration of 'java.lang.reflect.Type' appears in /system/framework/core-oj.jar)
        at com.github.theapache64.retrosheet.RetrosheetInterceptor$Companion.isSuspendMethodWithListReturnValue(RetrosheetInterceptor.kt:89)
        at com.github.theapache64.retrosheet.RetrosheetInterceptor$Companion.isReturnTypeList(RetrosheetInterceptor.kt:66)
        at com.github.theapache64.retrosheet.RetrosheetInterceptor$Companion.access$isReturnTypeList(RetrosheetInterceptor.kt:38)
        at com.github.theapache64.retrosheet.RetrosheetInterceptor.getRetrosheetResponse(RetrosheetInterceptor.kt:225)
        at com.github.theapache64.retrosheet.RetrosheetInterceptor.intercept(RetrosheetInterceptor.kt:169)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:229)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:172)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant