"Indirectly used type is defined in an unreferenced assembly"

I’m getting a strange build error when calling the method openDrawer() on an Android DrawerLayout:

E: Indirectly used type "androidx.customview.widget.Openable" is defined in an unreferenced assembly ()

You can find the code for the open source DrawerLayout on Github and see that it implements Openable, which is defined in a DrawerLayout dependency available in androidx.customview:customview

public class DrawerLayout extends ViewGroup implements Openable

Even if I include androidx.customview:customview in my project as CopyLocal, I still get the same error. I also am getting this error anywhere from .2587 to .2606.

Here’s a sample test case:
org.gradletest.zip (44.6 KB)

This happens when your code uses a.jar and a.jar uses a type from b.jar, but you domino have a reference to b.jar in your own project. Could this be the case here?

Ah ok. Well my code isn’t using it here. This is the code for Openable, just the 3 methods.

public interface Openable {
    boolean isOpen();
    void open();
    void close();
}

I’m getting the error trying to use openDrawer() on DrawerLayout.

And again, even if I include the library that defines Openable (which surely I shouldn’t have to?) then I still get the error.

@ck, any thoughts?

1 Like

fwiw I just noticed that in the sample project I uploaded, I’m calling open(). But it also happens calling openDrawer()

Ah ok I found something. If I remove the reference to appcompat from the sample project then it builds correctly. AppCompat shows that it depends on androidx.drawerlayout but does not show androidx.customview as a dependency within that. Perhaps the error is resulting from seeing androidx.customview missing as a dependency in the version of drawerlayout that is inside of appcompat?

Thanks, logged as bugs://85628

bugs://85628 got closed with status fixed.