`
dengyin2000
  • 浏览: 1207373 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

解决Intellij Idea,Android Stuido的“Ambiguous method call getClass()” bug

 
阅读更多
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:

// 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:http://stackoverflow.com/questions/18505973/android-studio-ambiguous-method-call-getclass
分享到:
评论
2 楼 dengyin2000 2014-07-14  
syluke 写道
遇到这个问题,我通常都是使用this.getClass()l来绕过去的。

历史遗留代码, 改的地方太多。 intellij idea红色的error看起来太刺眼。
1 楼 syluke 2014-07-14  
遇到这个问题,我通常都是使用this.getClass()l来绕过去的。

相关推荐

Global site tag (gtag.js) - Google Analytics