Android error building player Error: No resource found that matches the given name
Howdy, all;
Unity 5.6b9, during build, build stops with the error output as below. The AndroidManifest.xml Application entry includes a theme element:
<application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false" android:isGame="false" android:theme="@style/VrActivityTheme">
Which seems to be the root of the problem. Is this theme undefined or what am I missing?
CommandInvokationFailure: Failed to re-package resources.
/Users/thompson/Library/Android/sdk/build-tools/25.0.2/aapt package --auto-add-overlay -v -f -m -J "gen" -M "AndroidManifest.xml" -S "res" -I "/Users/thompson/Library/Android/sdk/platforms/android-25/android.jar" -F bin/resources.ap_ --extra-packages com.google.gvr.permissionsupport -S "/Users/thompson/Documents/Development/Mouse Attack Coaster.old/Temp/StagingArea/android-libraries/gvr-permissionsupport-release/res"
stderr[
AndroidManifest.xml:4: error: Error: No resource found that matches the given name (at 'theme' with value '@style/VrActivityTheme').
]
stdout[
Configurations:
(default)
Files:
layout/dialog.xml
Src: () /Users/thompson/Documents/Development/Mouse Attack Coaster.old/Temp/StagingArea/android-libraries/gvr-permissionsupport-release/res/layout/dialog.xml
values/values.xml
Src: () /Users/thompson/Documents/Development/Mouse Attack Coaster.old/Temp/StagingArea/android-libraries/gvr-permissionsupport-release/res/values/values.xml
AndroidManifest.xml
Src: () AndroidManifest.xml
Resource Dirs:
Type layout
layout/dialog.xml
Src: () /Users/thompson/Documents/Development/Mouse Attack Coaster.old/Temp/StagingArea/android-libraries/gvr-permissionsupport-release/res/layout/dialog.xml
Type values
values/values.xml
Src: () /Users/thompson/Documents/Development/Mouse Attack Coaster.old/Temp/StagingArea/android-libraries/gvr-permissionsupport-release/res/values/values.xml
Including resources from package: /Users/thompson/Library/Android/sdk/platforms/android-25/android.jar
applyFileOverlay for drawable
trying overlaySet Key=app_icon.png
applyFileOverlay for layout
applyFileOverlay for anim
applyFileOverlay for animator
applyFileOverlay for interpolator
applyFileOverlay for transition
applyFileOverlay for xml
applyFileOverlay for raw
applyFileOverlay for color
applyFileOverlay for menu
applyFileOverlay for mipmap
Processing image: res/drawable-ldpi/app_icon.png
Processing image: res/drawable-mdpi/app_icon.png
Processing image: res/drawable-hdpi/app_icon.png
Processing image: res/drawable-xhdpi/app_icon.png
(processed image res/drawable-mdpi/app_icon.png: 99% size of source)
Processing image: res/drawable-xxhdpi/app_icon.png
(processed image res/drawable-ldpi/app_icon.png: 99% size of source)
Processing image: res/drawable-xxxhdpi/app_icon.png
(processed image res/drawable-hdpi/app_icon.png: 99% size of source)
(processed image res/drawable-xhdpi/app_icon.png: 99% size of source)
(processed image res/drawable-xxhdpi/app_icon.png: 99% size of source)
(processed image res/drawable-xxxhdpi/app_icon.png: 99% size of source)
(new resource id app_icon from ldpi-v4/drawable/app_icon.png #generated)
(new resource id app_icon from mdpi-v4/drawable/app_icon.png #generated)
(new resource id app_icon from hdpi-v4/drawable/app_icon.png #generated)
(new resource id app_icon from xhdpi-v4/drawable/app_icon.png #generated)
(new resource id app_icon from xxhdpi-v4/drawable/app_icon.png #generated)
(new resource id app_icon from xxxhdpi-v4/drawable/app_icon.png #generated)
(new resource id dialog from /Users/thompson/Documents/Development/Mouse Attack Coaster.old/Temp/StagingArea/android-libraries/gvr-permissionsupport-release/res/layout/dialog.xml)
]
exit code: 1
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.PostProcessor.Tasks.TasksCommon.Exec (System.String command, System.String args, System.String workingdir, System.String errorMsg, Int32 retriesOnFailure)
UnityEditor.HostView:OnGUI()
Answer by congressman · Feb 21, 2017 at 08:47 PM
Ah, rookie mistake! gvr_base_1_0_0.aar contains this info, and had been somehow purged from the build. Re-added and all is well
Hi, Can you tell me what you mean by 're-added'? I'm also going through this frustration of creating a simple build for cardboard with : Unity 5.6b9 and the latest GoogleVRforUnity Sdk.
I try to build one of the demo scenes, and it halts at CommandInvokationFailure: Failed to re-package resources. Android$$anonymous$$anifest.xml:4: error: Error: No resource found that matches the given name (at 'theme' with value '@style/VrActivityTheme').
It looks like Unity 5.6b9 creates it's own Android$$anonymous$$anifest.xml based on which SDk is selected (I chose Cardborard in player settings under VR enabled)
It seems you can't place your own Android$$anonymous$$anifest.xml in Assets->Plugins-->Android. It gets ignored in the build and Unity stops at this error.
I find the file you mentioned in a "Temp" folder that gets created in the same directory as the Unity Project. But the .apk never completes because of this error.
I think this might be a bug in the latest Unity beta build. Building an apk without the cardboard sdk chosen in the Player settings works just fine.
@cly3d asked "Hi, Can you tell me what you mean by 're-added'?".
I mean I deleted the Assets/Plugins and then imported the GVR 1.0.0 unity package. It seems mysterious and I don't trust it as a solution but it "seems" to have worked for me.
Answer by Dirrogate · Feb 24, 2017 at 09:06 PM
Just to re-state this:
I'm facing an error in doing a simple build using a clean install of Unity 5.6b9 and the latest GoogleVR SDk (I've imported the SDK because it contains the demo examples)
The build process stops at: CommandInvokationFailure: Failed to re-package resources. AndroidManifest.xml:4: error: Error: No resource found that matches the given name (at 'theme' with value '@style/VrActivityTheme').
Can anyone else confirm this is happening to them?
Thanks.
Answer by VpzomTrrfrt · Jun 20, 2017 at 06:41 PM
In my case, I forgot to add the SDK to the VR SDKs in Player Settings.