简体   繁体   English

当项目连接到Asset Server时,Facebook Unity SDK android barfs

[英]Facebook Unity SDK android barfs when project connected to Asset Server

Tricky little issue. 棘手的小问题。 A test project with FB plugin worked fine, my project gave me below error. 一个带有FB插件的测试项目运行良好,我的项目给了我以下错误。 Turns out when i connected FB test project to asset server, and the .meta files got created for each folder, it would barf also. 原来,当我将FB测试项目连接到资产服务器,并且为每个文件夹创建了.meta文件时,它也会发出声响。 Any way to tell compiler to skip .meta files? 有什么办法告诉编译器跳过.meta文件?

Error building Player: CommandInvokationFailure: Failed to re-package resources. See the     Console for details.
/Users/me/android-sdk-macosx/platform-tools/aapt package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "/Users/me/android-sdk-   macosx/platforms/android-17/android.jar" -F bin/resources.ap_ --extra-packages com.facebook.android -S "/Users/me/Unity/FBTest/Assets/Plugins/Android/facebook/res"

stderr[
invalid resource directory name: /Users/me/Unity/FBTest/Assets/Plugins/Android/facebook/res/drawable-hdpi.meta
invalid resource directory name: /Users/me/Unity/FBTest/Assets/Plugins/Android/facebook/res/drawable-ldpi.meta
invalid resource directory name: /Users/me/Unity/FBTest/Assets/Plugins/Android/facebook/res/drawable-mdpi.meta

UPDATE: can't seem to get rid of .meta files, even though i disconnected from asset server :( any ideas? 更新:即使我与资产服务器断开连接,似乎也无法摆脱.meta文件:(有什么想法吗?

UPDATE: had to go Edit -> Project Settings -> Editor and disable version control to get this to compile. 更新:必须去编辑->项目设置->编辑器,并禁用版本控制才能进行编译。 Would be nice if this could be fixed so meta files are ignored in the packageing of an APK... 如果可以解决这个问题,那就太好了,因此在打包APK时会忽略元文件...

May as well mark this as answered. 也可以将此标记为已回答。 The .meta files added for asset server are breaking the android packaging, so the work around is to disable source control under Edit -> Project Settings -> Editor before doing a build. 为资产服务器添加的.meta文件破坏了android的包装,因此解决方法是在执行构建之前在“编辑”->“项目设置”->“编辑器”下禁用源代码控制。 Be nice if this was fixed so that step was unnecessary though... 如果已解决此问题,那就很好了,尽管这是不必要的步骤...

UPDATE: 更新:

Um, reconnecting to asset server makes it think everything locally has changed, so this is a really, really sucky workaround 嗯,重新连接到资产服务器使它认为本地所有内容都已更改,因此这是一个非常非常麻烦的解决方法

Found a stupid workaround because I was having the exact same problem, only tested on OSX since it relies on executing a python script via the hashbang line. 发现了一个愚蠢的解决方法,因为我遇到了完全相同的问题,仅在OSX上进行了测试,因为它依赖于通过hashbang行执行python脚本。

  1. Go find the path where aapt is in your android SDK (android-sdk-macosx/build-tools/17.0.0/aapt for example) and rename it to aapt.real 在您的android SDK中找到aapt的路径(例如android-sdk-macosx / build-tools / 17.0.0 / aapt)并将其重命名为aapt.real
  2. Make a new file called aapt and put the following in it: 制作一个名为aapt的新文件,并将以下内容放入其中:

     #!/usr/bin/env python import os import sys os.execv(os.path.join(os.path.split(__file__)[0], 'aapt.real'), ['aapt'] + sys.argv[1:] + ['--ignore-assets', '!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~:!*.meta']) 
  3. Wonder why Unity doesn't include the --ignore-assets option to fix this problem. 想知道为什么Unity不包含--ignore-assets选项来解决此问题。

i added the line 我加了线

<property name="aapt.ignore.assets" value="!*.meta:!.svn:!.git:.*:&lt;dir&gt;_*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~" />

to the build.xml file of the facebook android unity sdk. 到facebook android unity sdk的build.xml文件。 no need to patch android sdk. 无需修补android sdk。

Another workaround that seems to work is to delete all the .meta files from the res folder after starting the build, but before unity starts the packaging process. 另一个可行的解决方法是,在开始构建之后但在unity开始打包过程之前,从res文件夹中删除所有.meta文件。 Unity will not recreate the meta files while it is building the project. 在构建项目时,Unity不会重新创建元文件。 This way you don't have to disable and re-enable version control. 这样,您不必禁用和重新启用版本控制。

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

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