解决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

猜你喜欢

转载自dengyin2000.iteye.com/blog/2072716