Search Issue Tracker
Fixed in 2022.2.X
Votes
1
Found in
2019.4
2020.3
2021.1
2021.2
2021.2.0f1
2022.1
Issue ID
1382574
Regression
No
[Android] Hidden files in StreamingAssets folder are not included in builds for Android, but included for other platforms
Reproduction steps:
1. Open the attached project "StreamingAssetsBug"
2. Build the project for Android
3. Change the extension of the created file from .apk to .zip
4. Unzip and open the unzipped folder
5. Open the "assets" folder
6. Make sure you are able to see hidden files
Expected result: Both hidden and not hidden files are in the assets folder
Actual result: Only not hidden files are in the assets folder
Reproducible with: 2019.4.33f1, 2020.3.24f1, 2021.1.28f1, 2021.2.5f1, 2022.1.0a16
Workaround:
To fix this issue, you can customize your gradle build.
( Please refer to "Customizing your Gradle build" section in this link https://docs.unity3d.com/2021.1/Documentation/Manual/android-gradle-overview.html)
Steps:
1. Go to "Publishing Settings" section of "Player Settings" (menu: File> Build Settings > Player Settings)
2. Check "Custom Main Gradle Template" and check "Custom Launcher Gradle Template." (The picture in the link is outdated.)
3. Now you can see the path of your gradle build files like below.
"Assets/Plugins/Android/mainTemplate.gradle"
"Assets/Plugins/Android/launcherTemplate.gradle"
4. Find "mainTemplate.gradle" in the path and open the file.
5. Change "aaptOptions.ignoreAssetsPattern" like below. (Find ":.*" in the middle of the pattern list and remove it)
aaptOptions {
....
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
}
6. Find "launcherTemplate.gradle" in the path and open the file and change aaptOptions.ignoreAssetsPattern like in the step 5.
Recap: Change aaptOptions.ignoreAssetsPattern in the custimized gradle files
from "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
to "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
One more thing, to understand patterns syntax, you can look at the bottom of this page(https://stackoverflow.com/questions/28934333/how-can-i-use-android-aaptoptions)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Crash on EditorOnlyPlayerSettings::GetDefaultTextureCompressionFormat when switching or opening a specific project with Android or IOS Platform
- [Mobile] Player silently crashes on a mobile device when using a lot of "Camera" GameObjects (40 and more) in the Scene
- Scene is modified after exiting Play Mode when Graphics Compositor is enabled in HD RP
- Shortcuts inconsistently trigger when they have a conflict with the same Command
- On Script import/reimport MonoImporter does not generate consistent results due to updating Custom packages
Resolution Note (fix version 2022.2):
Fixed in: 2022.2.0a5