Android SDK Build-tools 22.0.1 inventing folders within res in the generated APK

4

I'm using Android Studio 1.2.1.1 , with Gradle 2.2.1 , and this is a snippet (the relevant part) of my my resource folders structure:

res
 |- layout
 |- layout-v21
 |- values
 |- values-v11
 |- values-v13
 |- values-v14
 |- values-v21
 |- xml

When I generate the APK with Android SDK Build-tools 20.0.0 , this same structure is found inside the APK file (which can be checked by opening the APK file with several file compression programs, such as 7-zip).

However, when I change to Android SDK Build-tools 22.0.1 , the folder structure inside the APK looks like this below:

res
 |- layout
 |- layout-v11
 |- layout-v21
 |- values
 |- values-v11
 |- values-v13
 |- values-v14
 |- values-v21
 |- xml
 |- xml-v14
 |- xml-v17

Detail for folders layout-v11 , xml-v14 and xml-v17 that are not part of my project.

This, in addition to impacting the final size of the APK file, makes me worried. what am I doing wrong? Is there a new setting in 22.0.1 ?

By hour, I solved the problem by only remaining with the 20.0.0 version, but I would like to know how to resolve this, to migrate to the newer version without any folders and features appearing in APK.

Update

After a lot of internet search (unsuccessful) and many tests, I think I have figured out what causes Android SDK Build-tools 22.0.1 to "invent" those folders in APK.

I did some initial tests with the layout and layout-v21 folders. Of all XML files within the layout folder, some of them have elements with the following attributes:

android:splitMotionEvents
android:nextFocusForward

Both attributes belong to API 11, and the minimum API supported by my project is API 10.

So, apparently, during the APK generation, Android SDK Build-tools 22.0.1 kept a copy of my layouts by removing the mentioned attributes, and created a layout-v11 folder where you kept layouts < strong> with attributes, the way I created them.

This behavior is strange because the IDE itself says that it is not wrong to keep new attributes in layouts that will be used with old APIs (it says, and I've tested it countless times: devices with old APIs simply ignore these attributes silently).

I did not add this as an answer because I still need to run more tests to confirm this theory.

    
asked by anonymous 14.06.2015 / 21:45

1 answer

1

Some features of Material Design like Material Theme and custom transitions activities are only available on Android 5.0 (API level 21) and higher. However, you can design your applications to make use of these features when running on devices that support material design and still be compatible with devices running earlier versions of Android.

Folders such as layout-v11 , values-v11 , xml-v14 , etc. are designed to provide compatibility for Material Design for older versions of Android.

Note that you can also create custom folders to make the application's "visual" or "structure" different for each device.

(Source: Developer Material Compatibility )

    
22.06.2015 / 00:03