Android - 构建Player时出错:CommandInvokationFailure:无法重新打包资源

时间:2014-08-17 11:03:40

标签: android unity3d

当我尝试为Android构建我的游戏时,我收到此错误。但它成功地建立了网络播放器。我查了一切都是对的,
最近我认为我将我的团结升级到4.5.1

错误详情如下:

Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
D:\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20131030\sdk\build-tools\android-4.4\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "D:/adt-bundle-windows-x86_64-20131030/adt-bundle-windows-x86_64-20131030/sdk/platforms/android-18\android.jar" -F bin/resources.ap_

stderr[
AndroidManifest.xml:9: error: Error: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').
]
stdout[
Configurations:
 (default)
 hdpi
 ldpi
 xhdpi
 xxhdpi

Files:
  drawable\app_icon.png
    Src: () res\drawable\app_icon.png
    Src: (hdpi) res\drawable-hdpi\app_icon.png
    Src: (ldpi) res\drawable-ldpi\app_icon.png
    Src: (xhdpi) res\drawable-xhdpi\app_icon.png
    Src: (xxhdpi) res\drawable-xxhdpi\app_icon.png
  values\strings.xml
    Src: () res\values\strings.xml
  AndroidManifest.xml
    Src: () AndroidManifest.xml

Resource Dirs:
  Type drawable
    drawable\app_icon.png
      Src: () res\drawable\app_icon.png
      Src: (hdpi) res\drawable-hdpi\app_icon.png
      Src: (ldpi) res\drawable-ldpi\app_icon.png
      Src: (xhdpi) res\drawable-xhdpi\app_icon.png
      Src: (xxhdpi) res\drawable-xxhdpi\app_icon.png
  Type values
    values\strings.xml
      Src: () res\values\strings.xml
Including resources from package: D:\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20131030\sdk\platforms\android-18\android.jar
applyFileOverlay for drawable
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-hdpi\app_icon.png
Processing image: res\drawable\app_icon.png
    (processed image res\drawable\app_icon.png: 97% size of source)
Processing image: res\drawable-ldpi\app_icon.png
    (processed image res\drawable-ldpi\app_icon.png: 98% size of source)
Processing image: res\drawable-xhdpi\app_icon.png
    (processed image res\drawable-hdpi\app_icon.png: 98% size of source)
Processing image: res\drawable-xxhdpi\app_icon.png
    (processed image res\drawable-xhdpi\app_icon.png: 98% size of source)
    (processed image res\drawable-xxhdpi\app_icon.png: 98% size of source)
    (new resource id app_icon from drawable\app_icon.png #generated)
    (new resource id app_icon from hdpi\drawable\app_icon.png #generated)
    (new resource id app_icon from ldpi\drawable\app_icon.png #generated)
    (new resource id app_icon from xhdpi\drawable\app_icon.png #generated)
    (new resource id app_icon from xxhdpi\drawable\app_icon.png #generated)
]

4 个答案:

答案 0 :(得分:15)

我从Android \ sdk \ build-tools中删除了24.0.0 build tools文件夹,它正在运行!

答案 1 :(得分:3)

您需要在plugins \ android中的androidsdk \ extra \ google文件夹中放置google_play_service_lib文件夹,以使其正常工作。

你可以在android-sdk-windows \ extras \ google \ google_play_services \ libproject中找到它。在那里你会找到google_play_service_lib。你在plugins / android中以单位复制它

归功于Ouss。

注意:如果它已经在那里,那么你很可能已经更新了android sdk,所以你需要新的lib文件夹。关闭团结>删除google play services lib文件夹>转到上面列出的sdk文件夹>复制上面地址中的lib文件夹>回到你的Unity应用程序中的android插件文件夹>将其粘贴在那里>重新打开统一并允许脚本编译>建立。

答案 2 :(得分:2)

那里有一个新问题。如果您安装了Android预览版SDK 24.0.0(如果您在构建工具文件夹中有这样的文件夹),则unity不会正确构建/重新打包。

我看到了这个问题:

CommandInvokationFailure: Failed to re-package resources. See the Console for details.
C:\android-sdk\build-tools\24.0.0-preview\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/android-sdk\platforms\android-23\android.jar" -F bin/resources.ap_ --extra-packages android.support.v7.appcompat:com.everyplay.Everyplay:com.google.example.games.mainlibproj:com.google.android.gms.base:com.google.android.gms:com.google.android.gms.drive:com.google.android.gms.games:com.google.android.gms.nearby:com.google.android.gms.plus:android.support.v4 -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\appcompat-v7-23.1.1\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\everyplay\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\play-services-base-8.4.0\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\play-services-basement-8.4.0\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\play-services-drive-8.4.0\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\play-services-games-8.4.0\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\play-services-nearby-8.4.0\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\play-services-plus-8.4.0\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\support-v4-23.1.1\res"

stderr[

]
stdout[
Configurations:
 (default)

Files:
  AndroidManifest.xml
    Src: () AndroidManifest.xml

Resource Dirs:
Including resources from package: C:\android-sdk\platforms\android-23\android.jar
applyFileOverlay for drawable
trying overlaySet Key=ic_plusone_medium_off_client.png
trying overlaySet Key=ic_plusone_small_off_client.png
trying overlaySet Key=ic_plusone_standard_off_client.png
trying overlaySet Key=ic_plusone_tall_off_client.png
trying overlaySet Key=common_full_open_on_phone.png
trying overlaySet Key=common_google_signin_btn_icon_dark.xml
trying overlaySet Key=common_google_signin_btn_icon_dark_disabled.9.png

我找到的唯一可行解决方案是卸载24.0.0构建工具文件夹 - 意味着只需将其删除并重新启动Unity即可。似乎Unity在新的Android 24构建工具方面存在问题。

编辑:您将在Android SDK文件夹中找到构建工具文件夹

答案 3 :(得分:1)

我做了什么并且有效。

我只有jre而不是jdk。首先我从oracle网站下载jdk 设置环境路径:

JAVA_HOME
C:\ Program Files(x86)\ Java \ jdk1.8.0_11 \ bin

但错误再次存在。

========================================

然后我得到了这个指南: 试试这个并告诉它是否有效。

从>复制zipalign.exe文件D:\ adt-bundle-windows-x86_64-20131030 \ adt-bundle-windows-x86_64-20140702 \ adt-bundle-windows-x86_64-20140702 \ sdk \ build-tools \ android-4.4W

或者你曾经拥有它然后过去到> D:\ adt-bundle-windows-x86_64-20131030 \ adt-bundle-windows-x86_64-20140702 \ adt-bundle-windows-x86_64-20140702 \ sdk \ tools

Unity3diy forums

一切都很完美:)