getClass() in abstract class gives Ambiguous method call

后端 未结 5 1594
北海茫月
北海茫月 2021-01-31 13:39

I have a public abstract class and I\'m trying to use the getClass() method, as I will need info from the class extending my abstract class. An example is this:

5条回答
  •  花落未央
    2021-01-31 14:06

    I noticed that it depends on the Android version you are referencing whether the error occurs or not. I used to define a dependency for Android 4.1.1.4 in the pom.xml linking to Maven Central.

    
        com.google.android
        android
        4.1.1.4
        provided
    
    

    Meanwhile, I provide the needed dependencies using maven-android-sdk-deployer.

    
        android
        android
        4.3_r1
        provided
    
    

    Then getClass() produces the error.

提交回复
热议问题