Search code examples
androidoopaar

Access to methods in an abstract class in an Android Studio library


I created a library in Android Studio (aar) and have successfully imported it into another application I have created. In the library, I have a base abstract class which I extend from in order to make the class that I want to use in my new application. In my application, I am successful in calling methods in the library's child class but it doesn't seem to have access to the methods in the base abstract class.

Library

AbstractClass {
    public void methodAbstractClass();
}

ChildClass extends AbstractClass {
    public void methodChildMethod();
}

MainApplication

  import ChildClass;

  MainApplication {
     public void doWork() {
       methodChildMethod(); // Works
       methodAbstractClass(); // Does not work, not visible
     }
  }

Am I missing something? Do I need to add overriding calls in my ChildClass class in the library so that the application can access methods in the AbstractClass class?


Solution

  • Might be that you're only importing the ChildClass.