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
- Sprites are not rotating with bones when the Sprite type is Unlit
- Crash on TransferField_NonArray<YAMLRead,Converter_String> when opening a specific project
- Missing page when opening reference for Panel Text Settings
- PlasticSCM NullReferenceException on entering the Play Mode when Unity Version Control tab is added to the layout
- Shortcut Helper Bar does not appear when enabling it and disabling it
Resolution Note (fix version 2022.2):
Fixed in: 2022.2.0a5