2

environment: android studio 3.3 gradle 3.2.1 When build library proejct using with gradle 3.2.1(android studio 3.3) aar file include empty folder at root directory like below image.

enter image description here

I think that folders unnecessary because that files exist real file in jni folder or res folder. Is that structure is right? So how can I exclude that folders?

shizhen
  • 12,251
  • 9
  • 52
  • 88
jskim
  • 23
  • 5

2 Answers2

0

Those folders are for mipmap drawables and for architecture specific build artifacts. Here are other files and directories that could be included (https://developer.android.com/studio/projects/android-library#aar-contents):

/AndroidManifest.xml
/classes.jar
/res/
/R.txt
/public.txt

Additionally, an AAR file may include one or more of the following optional entries:

/assets/
/libs/name.jar
/jni/abi_name/name.so (where abi_name is one of the Android supported ABIs)
/proguard.txt
/lint.jar
Ray Hunter
  • 15,137
  • 5
  • 53
  • 51
  • I agree that folders(red squere box) include in aar file. but those folders are empty folder and duplicated the real file(folder) exist under '/res/' or '/jni/ ' directory – jskim Feb 01 '19 at 01:49
  • @김종선 it is how the zip (aar) is getting created. It is probably just zipping up the top level folder. Since the folders are empty is does not matter either way. – Ray Hunter Feb 01 '19 at 02:07
0

So how can I exclude that folders?

Try this

android {
...
packagingOptions {
    exclude "mipmap**"
}
...
}
shizhen
  • 12,251
  • 9
  • 52
  • 88
  • My only concern here is excluding folders that the build system creates that do not cause errors of any kind. If they do get filled in the future, then this would exclude them and someone might not realize it. Esp with the architecture folders. – Ray Hunter Feb 01 '19 at 15:36