Both the current official Google Cardboard app and the older versions of the Google Cardboard drivers for Unity work for Android 4.1 and above.
However the current version of Google Cardboard for Unity library is set for Android 4.4 and above. I have tried to change the settings from 4.4 to 4.1 searching all the strings like: <uses-sdk android:minSdkVersion="19"
to change it to <uses-sdk android:minSdkVersion="16"
.
The player settings has been change to 16 too.
Unfortunately I get the following error when compiling:
Error: [Temp/StagingArea/AndroidManifest-main.xml:14, /Users/ch/workspaces/unity_workspace/educainventions/Temp/StagingArea/android-libraries/unitygvractivity/AndroidManifest.xml:2]
Main manifest has <uses-sdk android:minSdkVersion='16'> but library uses minSdkVersion='19'
And that's right: /Temp/StagingArea/android-libraries/unitygvractivity/AndroidManifest.xml is set to minSdkVersion='19'
I have changed that file to 16 too, but when compiling it changes to 19, and the same error occurs.
What creates that file to change it from 19 to 16? I think a solution could be to generate the Android code, then compile it with Android Studio. However doing it every time would be very slow so a continuos waste of time...
The generated file with
19
instead16
is created at:Temp/StagingArea/android-libraries/unitygvractivity/AndroidManifest.xml
. I have realised that we can find a file with the same name of that folder,unitygvractivity.aar
, withinAssets/Plugins/Android/
. Searching on Google I have found that we can decompress that file. I decompress it with The Unarchiver in OSX. According to this answer, we could also execute:Once unziped, we can find
AndroidManifest.xml
within the extracted folderunitygvractivity
. We change19
by16
in that file, and we compress it back to the aar format. According to the same answer we can execute:Finally we change the original
unitygvractivity.aar
file by the new one we just created. It will compile.So the next question is: if it has worked in Android 4.1, why Google set it for 4.4 and above? Maybe a part of the library I did not use need 4.4?
UPDATE: Answer of Google (https://github.com/googlevr/gvr-unity-sdk/issues/439):