How to include Manifest.class into the jar?

Hi,
I am writing an Android library and build it with Gradle 4.x. I have defined some permissions and need to check if the app is granted the permission in my code, like: hasPermission(Manifest.permission.MY_PERMISSION) . However after the project finishes building and produced the aar file, I unzip the aar, and found that the classes.jar file does not contain Manifest.class and Manifest$permission.class, which makes the app depending on the aar fails to build. Manifest.java is an intermediate artifacts and I can see Manifest.class file is generated after the compiling taske. I have checked that it is task transformClassesAndResourcesWithSyncLibJarsFor* that filters the Manifest classes, probably this is the code: URL. I have tried to unjar the classes.jar and manually put the Manifest classes to it, but the size of the repackaged jar is even smaller. May I know how I can put the manifest file back into the jar during build time?