getAnnotationsByType(Java 8)的解糖不起作用

huangapple go评论60阅读模式
英文:

getAnnotationsByType (Java 8) desugaring not working

问题

我正尝试通过在 SDK 版本< 24 中进行解糖来使用 Java 8 特性。
根据 https://developer.android.com/studio/write/java8-support?hl=el,应该支持 getAnnotationByType,但我遇到了 java.lang.NoSuchMethodError: java.lang.reflect.Method.getAnnotationsByType 的错误。

这种情况下解糖是否不起作用?根据谷歌文档,支持“重复注释”。

请注意,我所有其他的解糖都正常工作,这不是我在 build.gradle 中没有正确指定解糖选项的问题。

英文:

I am trying to use Java 8 features through desugaring in SDK < 24.
getAnnotationByType should be supported according to https://developer.android.com/studio/write/java8-support?hl=el but I encounter java.lang.NoSuchMethodError: java.lang.reflect.Method.getAnnotationsByType

Is desugaring not working for this use case? According to google documentation, "Repeating Annotations" are supported.

Do note that all my other desugaring works fine, it isn't an issue with me not specifying desugaring options in my build.gradle incorrectly.

答案1

得分: 0

java.lang.reflect.Method.getAnnotationsByType 的去糖化仅在 API 26 及更高版本上受支持。

英文:

Desugaring of java.lang.reflect.Method.getAnnotationsByType is only supported on API 26+.

huangapple
  • 本文由 发表于 2020年6月29日 05:03:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/62628196.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定