I am using the 'res’ folder to specify dummy translations for the supported languages in ‘values’, ‘values-de’ … etc. so that the Google Play Store will see which languages are supported. In earlier versions of Unity this worked but in 5.2 the folders are not included in the build anymore.
There is also a problem with the AdMob plugin that I am using, it defines a variable for the version of the Google Play Services lib in the manifest file, it refers to ‘values/google_play_services_version.xml’ file, Unity 5.2 cannot find it anymore.
A build time warning is shown: OBSOLETE - Providing Android resources in Assets/Plugins/Android/res is deprecated, please move your resources to an Android Library. See “Building Plugins for Android” section of the Manual.
The Google Play Services lib version issue can be fixed by inserting the value into the manifest but how can I fix the supported languages?
I have similar issue with another plugin and it’s breaking our android build with UnauthorizedAccessException, when it tries to access a file from /assets/plugins/android/res
Is this something we can fix or do plugin makers need to update their plugins?
You can add those resources in the form of an Android library.
Assuming you use Unity 5 (or higher), the editor will look for certain files in a folder to determine if it’s an android library project.
For example, the following folder structure works:
Assets
| Plugins
|–MyCustomResources
|-- res
| |— values
| |— values-de
|-- project.properties
|-- Androidmanifest.xml
Unity looks for AndroidManifest.xml and project.properties to figure out it’s an android library. It will then merge that library into the final build (so you get all the resources defined in the res folder). The manifest can be a pretty bare one, just so Unity will know this is a library.
@liortal
Thanks for the information.
I will try to use your folder structure.
Having to create a dummy library for adding some basic app resources is weird, but I am happy that there is still a way to accomplish this and to localise the app name.
it’s not really weird, as the older plugins/res folder must be also some kind of a library… the older structure was a “hack” since you only created a res folder, but Unity took care of the rest i guess.
Now they’re enforcing you create a proper library structure…
In my case I am using the same structure as @liortal said, but Resource not found not resolving,
Note: I am facing this issue only in unity 5.2.
Below to 5.2, everything works fine.
Unity knows how to build that. You can either place precompiled libraries (in .jar or .aar format) in your Unity project, or have an “Android library” - that folder with a particular hierarchy structure and required files (as stated above). Unity will handle it by compiling it and merging it into the final game package.