[英]Unity exporting android project with Facebook SDK issue
I found an issue on exporting a project from Unity3D to Android Studio when Facebook SDK is involved. 我发现在涉及Facebook SDK时将项目从Unity3D导出到Android Studio时出现问题。 Currently I'm using Unity 5.4.1f1 and facebook-unity-sdk-7.9.0 .
目前我正在使用Unity 5.4.1f1和facebook-unity-sdk-7.9.0 。
Here the steps to reproduce the issue : 这里是重现问题的步骤:
Error:(131) Error retrieving parent for item: No resource found that matches the given name '@style/Theme.AppCompat.NoActionBar'.
错误:(131)检索项目的父项时出错:找不到与给定名称“@ style / Theme.AppCompat.NoActionBar”匹配的资源。
Error:(136) Error retrieving parent for item: No resource found that matches the given name '@style/Theme.AppCompat.Dialog'.
错误:(136)检索项目的父项时出错:找不到与给定名称“@ style / Theme.AppCompat.Dialog”匹配的资源。
Error:(131) Error retrieving parent for item: No resource found that matches the given name '@style/Theme.AppCompat.NoActionBar'.
错误:(131)检索项目的父项时出错:找不到与给定名称“@ style / Theme.AppCompat.NoActionBar”匹配的资源。
Error:(136) Error retrieving parent for item: No resource found that matches the given name '@style/Theme.AppCompat.Dialog'.
错误:(136)检索项目的父项时出错:找不到与给定名称“@ style / Theme.AppCompat.Dialog”匹配的资源。
Error:Execution failed for task ':facebookandroidsdk4170:processDebugResources'.
错误:任务':facebookandroidsdk4170:processDebugResources'的执行失败。 com.android.ide.common.process.ProcessException: Failed to execute aapt
com.android.ide.common.process.ProcessException:无法执行aapt
Someone did face this and has already found a solution? 有人确实面对这个并且已经找到了解决方案吗?
Seems like you are missing the appcompat library, the problem with exporting to android studio is that it doesn't export .aar files well (at least before Unity 5.5). 好像你错过了appcompat库,导出到android studio的问题是它不能很好地导出.aar文件(至少在Unity 5.5之前)。
You have to copy all your .aar files in your Plugins/Android (there may be also in the facebook folder) into your android studio project libs folder. 你必须将你的插件/ Android中的所有.aar文件(也可能在facebook文件夹中)复制到你的android studio项目libs文件夹中。
Then open your app build.gradle (normally named app or same as your project's name) and put inside the dependencies this for each .aar file: 然后打开你的应用程序build.gradle(通常命名app或与你的项目名称相同),并为每个.aar文件放入这个依赖项:
compile(name: 'aarlibrarywithoutextension', ext: 'aar')
for example if you have a common.aar file you should put this: 例如,如果你有一个common.aar文件,你应该把它:
compile(name: 'common', ext: 'aar')
make sure in that file that you have this also: 确保在该文件中您还拥有此文件:
allprojects {
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
}
as the flatDir libs tells android studio to look for libraries there (remember that you copied all your .aar files from unity into the libs folder inside android studio project) 因为flatDir libs告诉android studio在那里寻找库(记得你将所有的.aar文件从unity复制到android studio项目中的libs文件夹中)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.