NoClassDef for classes in aar

Hi all,

I’m trying to build an Android plugin that uses a library included as an aar. Both aars from my plugin and the library are in my Plugins/Android folder. I can load up classes from my plugin in Unity without problem, but at runtime when the plugin, or Unity itself, tries to load classes from the library they fail with a java.lang.NoClassDefFoundError.

I’ve tried including the library within my plugin’s aar, using the jar contained within the library’s aar. I’ve tried setting up my plugin’s gradle project to depend on the library’s aar. Nothing has yielded results.

Is there something I might be doing wrong? Why would Unity not be able to load classes from the library, when it can load my plugin’s classes, and Android Studio has no trouble building my plugin when it references the library?

Thanks in advance!

I’ve narrowed it down to the super class of the class I’m accessing not being available. It’s part of the appcompat-v7 library, which I guess isn’t included for some reason.

I solved this by adding the appcompat-v7 dependency to the gradle project Unity built. Is there a way to do that from within Unity, or will I always have to add it to the gradle build scripts manually?