【问题标题】:(Unity3D-Android) Failded to build, always(Unity3D-Android) 始终无法构建
【发布时间】:2018-01-14 20:08:17
【问题描述】:

首先:抱歉英语不好。我正在尝试使用 unity3D 游戏引擎构建 android 游戏,但总是遇到这两个错误。

这是第一个。

CommandInvokationFailure: Failed to re-package resources.
C:\Android\build-tools\25.0.3\aapt.exe package --auto-add-overlay -v -f -m -J "gen" -M "AndroidManifest.xml" -S "res" -I "C:/Android\platforms\android-16\android.jar" -F bin/resources.ap_ --extra-packages android.support.v7.appcompat -S "C:\Users\Garrom\Desktop\Files\WarCity – Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res"

stderr[
C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-ldltr-v21\values-ldltr-v21.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v23\values-v23.xml:37: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:17: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:19: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:25: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:32: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:216: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:218: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:176: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:189: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.EditText'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:10: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:264: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:276: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification.Title'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:4: error: Error: No resource found that matches the given name: attr 'android:textAlignment'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:8: error: Error: No resource found that matches the given name: attr 'android:paddingEnd'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:11: error: Error: No resource found that matches the given name: attr 'android:layout_marginEnd'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:14: error: Error: No resource found that matches the given name: attr 'android:paddingEnd'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:17: error: Error: No resource found that matches the given name: attr 'android:layout_marginStart'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:20: error: Error: No resource found that matches the given name: attr 'android:layout_alignParentStart'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:21: error: Error: No resource found that matches the given name: attr 'android:textAlignment'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:25: error: Error: No resource found that matches the given name: attr 'android:paddingEnd'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:24: error: Error: No resource found that matches the given name: attr 'android:paddingStart'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:28: error: Error: No resource found that matches the given name: attr 'android:layout_alignParentStart'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:31: error: Error: No resource found that matches the given name: attr 'android:layout_toStartOf'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:34: error: Error: No resource found that matches the given name: attr 'android:layout_alignParentEnd'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:38: error: Error: No resource found that matches the given name: attr 'android:layout_toEndOf'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:37: error: Error: No resource found that matches the given name: attr 'android:layout_toStartOf'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:41: error: Error: No resource found that matches the given name: attr 'android:layout_marginStart'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:45: error: Error: No resource found that matches the given name: attr 'android:paddingEnd'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:44: error: Error: No resource found that matches the given name: attr 'android:paddingStart'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:49: error: Error: No resource found that matches the given name: attr 'android:paddingEnd'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v17\values-v17.xml:48: error: Error: No resource found that matches the given name: attr 'android:paddingStart'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:9: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:11: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:12: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:13: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:14: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:15: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:16: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:18: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:22: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:24: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:26: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Menu'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:27: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Subtitle'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:29: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Title'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:31: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:33: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Subhead'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:34: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Title'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:35: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:37: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:39: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:41: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title.Inverse'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:43: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:45: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:47: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:53: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:55: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.

C:\Users\Garrom\Desktop\Files\WarCity � Android\Temp\StagingArea\android-libraries\appcompat-v7-25.3.1\res\values-v21\values-v21.xml:57:<message truncated>

这是第二个:

UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x001b9] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:162 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83 
UnityEditor.HostView:OnGUI()

我正在使用 JDK 1.8 并针对 API 级别 16。我已经在 Plugins/Android 中有 appcompat v7 25.3.1。我总是收到此错误,但仅在尝试构建 apk 时出现。太令人沮丧了......我对android很陌生,以前只构建过windows游戏,这以前从未发生过。 谢谢。 -加罗姆

【问题讨论】:

  • 你的 Unity 版本是多少?
  • 如果这很重要,我正在使用 Unity3D 2017.1.1f1。 @萨满

标签: android unity3d compiler-errors android-build


【解决方案1】:

查看您的错误日志,我可以看到您正在使用 Android SDK Build-tools 版本:25.0.3,它低于编译支持库所需的最低版本。为了成功编译,Android SDK Build-tools 版本必须等于或高于支持库版本。因此,只需将您的 Android SDK Build-tools 更新到 26.0.0 或更高版本。

【讨论】:

  • 感谢您的提示。我更新了 Android SDK 构建工具,但现在我收到了这个错误。但至少我们正在取得进展。 Win32Exception: ApplicationName='C:/...\aapt.exe', CommandLine='package --auto-add-overlay -v -f -m -J "gen" -M "AndroidManifest.xml" -S "res" -I "C:/...\android-16\android.jar" -F bin/resources.ap_ --extra-packages android.support.v7.appcompat -S "C:\Users\Garrom\Desktop\Files\WarCity – Android\Temp\StagingArea\android-libraries\appcompat-v7-25.0.0\res"', CurrentDirectory='Temp/StagingArea', Native error= Cannot find file
  • 您的 Android SDK Build-tools 版本是多少?
  • 最新可用,27.0.3。之前,我使用 B4A 的 SDK 管理器,但在使用旧版本(和官方 sdk 管理器)后,我发现几个包丢失或损坏。如果我修复这些包,错误可能会消失
  • 该死,我又忘了提到你@Shaman。顺便说一句,我真的不太了解这个“appcompact”,如果我明白了,它就像是带有 android 资源的大存档,对吧?所以 Appcompact 25 意味着它将增加与 API 级别 25 的兼容性并且可以在任何 API 级别上使用,或者它增加了与其他 API 级别的兼容性但只能在级别 25 上使用?只是问,因为我试图在 API 级别 16 上使用 appcompact 25。
  • 现在我又遇到了原始错误。天哪,这是什么魔法.. 哦,是的,这就是我如此讨厌 java 的原因。我肯定做错了什么,但是什么?为什么没有人一步一步地教程如何为 android 导出准备项目? @萨满
猜你喜欢
  • 2020-04-27
  • 1970-01-01
  • 1970-01-01
  • 2014-03-30
  • 1970-01-01
  • 2017-11-24
  • 2016-09-19
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多