简体   繁体   English

使用unity3d构建Android应用

[英]Build android app with unity3d

I would like to build a unity3d project to android app. 我想为Android应用程序建立一个unity3d项目。 i have installed all android sdk but i got always this error 我已经安装了所有android sdk,但我总是收到此错误

Failed to re-package resources. 重新打包资源失败。

And below the console logs : 在控制台日志下方:

Error building Player: CommandInvokationFailure: Failed to re-package resources. 构建Player时出错:CommandInvokationFailure:无法重新打包资源。 See the Console for details. 有关详细信息,请参见控制台。 C:\\Program Files (x86)\\Android\\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:/Program Files (x86)/Android/android-sdk\\platforms\\android-23\\android.jar" -F bin/resources.ap_ --extra-packages com.google.android.gms -S "C:\\Users\\ousla\\Documents\\WorkspaceUnity\\TestApp\\Temp\\StagingArea\\android-libraries\\google-play-services_lib\\res" stderr[ ] stdout[ Configurations: (default) v11 v21 C:\\ Program Files(x86)\\ Android \\ android-sdk \\ build-tools \\ 24.0.0-preview \\ aapt.exe软件包--auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S“ res” -I“ C:/ Program Files(x86)/Android/android-sdk\\platforms\\android-23\\android.jar” -F bin / resources.ap_ --extra-packages com.google.android .gms -S“ C:\\ Users \\ ousla \\ Documents \\ WorkspaceUnity \\ TestApp \\ Temp \\ StagingArea \\ android-libraries \\ google-play-services_lib \\ res” stderr [] stdout [配置:(默认)v11 v21

This looks like a Plugin conflict/problem. 这看起来像插件冲突/问题。

Copy your google-play-services_lib folder to your project's Plugins/Android folder. 将您的google-play-services_lib文件夹复制到项目的Plugins / Android文件夹。

OR 要么

Remove all your Plugins at Plugins/Android then re-import them but uncheck google-game-palay services_lib folder when re-importing them. Plugins / Android上 删除 所有插件,然后重新导入它们,但在重新导入时取消选中google-game-palay services_lib文件夹。

Unity is running aapt.exe from build-tools/24.0.0 ( you can see the path of aapt.exe in the log). Unity从build-tools / 24.0.0运行aapt.exe(您可以在日志中看到aapt.exe的路径)。 Version 24 is for Android N (the next upcoming version Android), which is not supported by Unity at the moment (many developers are complaining about this exact issue). 版本24适用于Android N(即将发布的下一个版本的Android),目前Unity尚不支持该版本(许多开发人员抱怨这个确切的问题)。

In order to resolve this issue, you have a few different options: 为了解决此问题,您有几种不同的选择:

Under your Android SDK folder, remove version 24.0.0 of build-tools (sdk/build-tools/24.0.0). 在您的Android SDK文件夹下,删除版本24.0.0的构建工具(sdk / build-tools / 24.0.0)。

You can do the same from the Android SDK manager (select build tools version 24 and then "delete package") 您可以从Android SDK管理器中执行相同操作(选择构建工具版本24,然后“删除程序包”)

SDK manager SDK管理员

In case you need that version specifically, you can install another Android SDK that will only be used with Unity. 如果您特别需要该版本,则可以安装将仅与Unity一起使用的另一个Android SDK。 In this installation, do not include build-tools 24. 在此安装中,不要包括构建工具24。

Lastly, you should try to upgrade to the latest Unity version, as this issue should be solved (I believe it was solved in 5.3.5p4). 最后,您应该尝试升级到最新的Unity版本,因为此问题应该得到解决(我相信在5.3.5p4中已解决)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM