Rather than modify your application code, you can avoid this bug by patching your Android SDK's source code.
When you come across the getClass() error, go to the declaration of the method (⌘B on Mac). This will navigate to $ANDROID_HOME/sources/android-DD/java/lang/Object.java. From within IntelliJ, make the following edit which removes the unbounded wildcard:
(If you do this from within IntelliJ, you may be prompted to remove the Read-Only flag from the Object.java file.)
reference:[url]http://stackoverflow.com/questions/18505973/android-studio-ambiguous-method-call-getclass[/url]
When you come across the getClass() error, go to the declaration of the method (⌘B on Mac). This will navigate to $ANDROID_HOME/sources/android-DD/java/lang/Object.java. From within IntelliJ, make the following edit which removes the unbounded wildcard:
// Removed unbounded wildcard (Class<?>) to avoid http://youtrack.jetbrains.com/issue/IDEA-72835
public final native Class getClass();(If you do this from within IntelliJ, you may be prompted to remove the Read-Only flag from the Object.java file.)
reference:[url]http://stackoverflow.com/questions/18505973/android-studio-ambiguous-method-call-getclass[/url]

本文介绍了一种解决Android Studio中出现getClass()错误的方法。通过修改Android SDK源代码中的Object.java文件,移除无界通配符以避免冲突。此操作可在IntelliJ IDEA中完成。

被折叠的 条评论
为什么被折叠?



